1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-09-16 09:06:21 +02:00

minor changes

autostash now has priority
send pings to map channels instead of announcements
This commit is contained in:
Gerkiz
2021-03-19 16:17:38 +01:00
parent 3e74bd8165
commit f07c77d421
3 changed files with 40 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ require 'modules.wave_defense.main'
require 'modules.charging_station'
-- Use these settings for live
local send_ping_to_channel = Discord.channel_names.announcements
local send_ping_to_channel = Discord.channel_names.mtn_channel
local role_to_mention = Discord.role_mentions.mtn_fortress
-- Use these settings for testing
-- bot-lounge

View File

@@ -394,6 +394,31 @@ local function insert_item_into_chest(player_inventory, chests, filtered_chests,
end
end
local priority = {
['coal'] = 1,
['iron-ore'] = 2,
['copper-ore'] = 3,
['stone'] = 4
}
local function switch_key_val(tbl)
local t = {}
for name, count in pairs(tbl) do
if priority[name] then
t[#t + 1] = {name = name, count = count, priority = priority[name]}
end
end
table.sort(
t,
function(a, b)
return a.priority > b.priority
end
)
return t
end
local function auto_stash(player, event)
local button = event.button
local ctrl = event.control
@@ -451,7 +476,11 @@ local function auto_stash(player, event)
end
end
for name, count in pairs(inventory.get_contents()) do
local getIndexInventory = switch_key_val(inventory.get_contents())
for i = #getIndexInventory, 1, -1 do
local name = getIndexInventory[i].name
local count = getIndexInventory[i].count
local is_resource = this.whitelist[name]
if not inventory.find_item_stack(name).grid and not hotbar_items[name] then
@@ -542,6 +571,7 @@ end
local function do_whitelist()
local resources = game.entity_prototypes
local items = game.item_prototypes
this.whitelist = {}
for k, _ in pairs(resources) do
if resources[k] and resources[k].type == 'resource' and resources[k].mineable_properties then
@@ -554,6 +584,13 @@ local function do_whitelist()
end
end
end
for k, _ in pairs(items) do
if items[k] and items[k].group.name == 'resource-refining' then
local r = items[k].name
this.whitelist[r] = true
end
end
end
local function on_player_joined_game(event)

View File

@@ -3,6 +3,7 @@ return {
--- The names of the discord channels that can be referenced by name.
-- See features.server.to_discord_named
channel_names = {
mtn_channel = 'mount-fortress',
bot_quarters = 'bot-quarters',
announcements = 'announcements',
mod_lounge = 'mods-lounge',