Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ factorio_mods
Instructions.png
Instructions2.png
cookiejar.txt
.vscode/settings.json
1 change: 1 addition & 0 deletions constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ constants.trash_blacklist = {
["upgrade-item"] = true,
["copy-paste-tool"] = true,
["selection-tool"] = true,
["spidertron-remote"] = true,
}

constants.gui_dimensions = {
Expand Down
26 changes: 26 additions & 0 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,32 @@ local function on_research_finished(e)
end
event.on_research_finished(on_research_finished)

local function on_entity_logistic_slot_changed(e)
if e.player_index == nil then return end

local player = game.get_player(e.player_index)
if not (player.character) then return end
local pdata = global._pdata[e.player_index]

local request = player.get_personal_logistic_slot(e.slot_index)
-- Request removed
if request.name == nil then end

-- Don't add request if it's already fulfilled
local contents = player.get_main_inventory().get_contents()
local item_count = contents[request.name] or 0
if item_count >= request.min and item_count <= request.max then
player.clear_personal_logistic_slot(e.slot_index)
player.print{"temporary-request-already-fulfilled"}
return
end

if player_data.set_request(player, global._pdata[player.index], request, true) then
player.print({"at-message.added-to-temporary-requests", at_util.item_prototype(request.name).localised_name})
end
end
event.on_entity_logistic_slot_changed(on_entity_logistic_slot_changed)

local at_commands = {
import = function(args)
local player_index = args.player_index
Expand Down
3 changes: 3 additions & 0 deletions locale/en/en.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ status-display=Show status display
trash-above-requested=Autotrash above requests
trash-unrequested=Autotrash unrequested items
trash-in-main-network=Autotrash only in main networks
config-button-apply=Apply changes
tooltip-pause-trash=(__CONTROL__autotrash_pause__)
tooltip-pause-requests=(__CONTROL__autotrash_pause_requests__)
tooltip-rip=Load preset when respawning
Expand Down Expand Up @@ -57,6 +58,8 @@ invalid-gui=Auto Trash: The GUI has become invalid. This likely means that anoth
no-presets-to-export=No presets to export.
preset-updated=Preset "__1__" updated.
added-to-temporary-trash=Added __1__ to temporary trash.
added-to-temporary-requests=Added __1__ to temporary requests.
temporary-request-already-fulfilled=Temporary request already fulfilled by items in inventory.
removed-from-temporary-requests=Removed __1__ from temporary requests.
character-needed=Personal logistic requests are only possible when using a character.
empty-cursor-needed=Click with an empty cursor.
Expand Down
1 change: 1 addition & 0 deletions scripts/global-data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function global_data.refresh()
{filter = "type", type = "upgrade-item", invert = true, mode = "and"},
{filter = "type", type = "copy-paste-tool", invert = true, mode = "and"},
{filter = "type", type = "selection-tool", invert = true, mode = "and"},
{filter = "type", type = "spidertron-remote", invert = true, mode = "and"},
{filter = "flag", flag = "hidden", invert = true, mode = "and"},
--{filter = "place-result", mode = "and"}
}
Expand Down
4 changes: 3 additions & 1 deletion scripts/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@ at_gui.handlers.presets = {
local player = e.player
local pdata = e.pdata
local name = e.element.caption
local textfield = pdata.gui.presets.textfield
textfield.text = name
if not e.shift then
pdata.selected_presets = {[name] = true}
pdata.config_tmp = at_util.copy_preset(pdata.presets[name])
Expand Down Expand Up @@ -1138,7 +1140,7 @@ function at_gui.create_main_window(player, pdata)
{type = "label", style = "subheader_caption_label", caption = {"at-gui.logistics-configuration"}},
gui_util.pushers.horizontal,
{type = "sprite-button", style = "item_and_count_select_confirm",
sprite = "utility/check_mark", tooltip = {"module-inserter-config-button-apply"},
sprite = "utility/check_mark", tooltip = {"at-gui.config-button-apply"},
actions = {on_click = {gui = "main", action = "apply_changes"}},
},
{type = "sprite-button", style = "tool_button_red", ref = {"main", "reset_button"}, sprite = "utility/reset",
Expand Down