From 7d3b4bef6aadee9524df9929697335d5d46596ec Mon Sep 17 00:00:00 2001 From: Adie Date: Mon, 30 May 2022 20:31:00 -0500 Subject: [PATCH 1/4] Exclude spidertron remotes from autotrash --- constants.lua | 1 + scripts/global-data.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/constants.lua b/constants.lua index cbb9c7b..8adb345 100644 --- a/constants.lua +++ b/constants.lua @@ -20,6 +20,7 @@ constants.trash_blacklist = { ["upgrade-item"] = true, ["copy-paste-tool"] = true, ["selection-tool"] = true, + ["spidertron-remote"] = true, } constants.gui_dimensions = { diff --git a/scripts/global-data.lua b/scripts/global-data.lua index 61b81c6..c65d0aa 100644 --- a/scripts/global-data.lua +++ b/scripts/global-data.lua @@ -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"} } From c8ba82edaf71a680b140b3f240a89075466dafde Mon Sep 17 00:00:00 2001 From: ComradeEcho Date: Sun, 19 Mar 2023 05:56:25 -0500 Subject: [PATCH 2/4] Fix "apply" button tooltip --- .gitignore | 1 + locale/en/en.cfg | 1 + scripts/gui.lua | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ec172c9..e1f8651 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ factorio_mods Instructions.png Instructions2.png cookiejar.txt +.vscode/settings.json diff --git a/locale/en/en.cfg b/locale/en/en.cfg index e1e494a..830bb4d 100644 --- a/locale/en/en.cfg +++ b/locale/en/en.cfg @@ -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 diff --git a/scripts/gui.lua b/scripts/gui.lua index 8a24f98..e9ca2bb 100644 --- a/scripts/gui.lua +++ b/scripts/gui.lua @@ -1138,7 +1138,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", From df74e269ce4c809b9f6f38e72ffeeb08c14c1cba Mon Sep 17 00:00:00 2001 From: ComradeEcho Date: Sun, 19 Mar 2023 08:42:50 -0500 Subject: [PATCH 3/4] Insert current preset name in textfield Seems like this would make it a lot more streamlined to load/edit/update presets - not having to manually type in the preset name to update it. --- scripts/gui.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/gui.lua b/scripts/gui.lua index e9ca2bb..1ae8ee2 100644 --- a/scripts/gui.lua +++ b/scripts/gui.lua @@ -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]) From b6151c1dd7ce61f07bb566798621fd2732120806 Mon Sep 17 00:00:00 2001 From: ComradeEcho Date: Sun, 19 Mar 2023 09:03:18 -0500 Subject: [PATCH 4/4] Allow setting temporary requests (cherry picked from commit 1524d6f839edfdba73220ba8d89d4e2e582b8535) --- control.lua | 26 ++++++++++++++++++++++++++ locale/en/en.cfg | 2 ++ 2 files changed, 28 insertions(+) diff --git a/control.lua b/control.lua index a18f0d6..04880a7 100644 --- a/control.lua +++ b/control.lua @@ -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 diff --git a/locale/en/en.cfg b/locale/en/en.cfg index 830bb4d..377e5ad 100644 --- a/locale/en/en.cfg +++ b/locale/en/en.cfg @@ -58,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.