From 3a8cdbd7984cff7292f07908062e7d57e9b2a55b Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Fri, 10 Jan 2025 21:32:38 +0100 Subject: [PATCH] Ported to 2.0 --- .../README.md | 0 .../changelog.txt | 30 ++++++++++++++++++ .../control.lua | 18 +++++------ .../data.lua | 0 .../info.json | 4 +-- .../thumbnail.png | Bin 6 files changed, 41 insertions(+), 11 deletions(-) rename {mods/show-missing-bottles-for-current-research => mods_2.0/052_show-missing-bottles-for-current-research}/README.md (100%) create mode 100644 mods_2.0/052_show-missing-bottles-for-current-research/changelog.txt rename {mods/show-missing-bottles-for-current-research => mods_2.0/052_show-missing-bottles-for-current-research}/control.lua (91%) rename {mods/show-missing-bottles-for-current-research => mods_2.0/052_show-missing-bottles-for-current-research}/data.lua (100%) rename {mods/show-missing-bottles-for-current-research => mods_2.0/052_show-missing-bottles-for-current-research}/info.json (80%) rename {mods/show-missing-bottles-for-current-research => mods_2.0/052_show-missing-bottles-for-current-research}/thumbnail.png (100%) diff --git a/mods/show-missing-bottles-for-current-research/README.md b/mods_2.0/052_show-missing-bottles-for-current-research/README.md similarity index 100% rename from mods/show-missing-bottles-for-current-research/README.md rename to mods_2.0/052_show-missing-bottles-for-current-research/README.md diff --git a/mods_2.0/052_show-missing-bottles-for-current-research/changelog.txt b/mods_2.0/052_show-missing-bottles-for-current-research/changelog.txt new file mode 100644 index 00000000..c695acab --- /dev/null +++ b/mods_2.0/052_show-missing-bottles-for-current-research/changelog.txt @@ -0,0 +1,30 @@ +--------------------------------------------------------------------------------------------------- +Version: 2.0.0 +Date: 2025. 01. 10 + Info: + - Ported to 2.0 +--------------------------------------------------------------------------------------------------- +Version: 1.0.3 +Date: 2024. 02. 09 + Info: + - Ignore labs with no bottles in them at all +--------------------------------------------------------------------------------------------------- +Version: 1.0.2 +Date: 2023. 12. 28 + Info: + - Ignore science packs that are only missing once (inserters / old lab / etc) +--------------------------------------------------------------------------------------------------- +Version: 1.0.1 +Date: 2023. 12. 28 + Info: + - Bring to front instead of killing the parent and its children +--------------------------------------------------------------------------------------------------- +Version: 1.0.0 +Date: 2023. 12. 28 + Info: + - Publish `Show missing bottles for current research` +--------------------------------------------------------------------------------------------------- +Version: 0.0.1 +Date: 2023. 12. 28 + Info: + - Stash show-missing-bottles-for-current-research concept diff --git a/mods/show-missing-bottles-for-current-research/control.lua b/mods_2.0/052_show-missing-bottles-for-current-research/control.lua similarity index 91% rename from mods/show-missing-bottles-for-current-research/control.lua rename to mods_2.0/052_show-missing-bottles-for-current-research/control.lua index e92b9b48..d79ecf21 100644 --- a/mods/show-missing-bottles-for-current-research/control.lua +++ b/mods_2.0/052_show-missing-bottles-for-current-research/control.lua @@ -1,9 +1,9 @@ local util = require('util') local function on_configuration_changed(event) - global.lab_inputs = {} - for _, entity_prototype in pairs(game.get_filtered_entity_prototypes({{filter = 'type', type = 'lab'}})) do - global.lab_inputs[entity_prototype.name] = util.list_to_map(entity_prototype.lab_inputs) + storage.lab_inputs = {} + for _, entity_prototype in pairs(prototypes.get_entity_filtered({{filter = 'type', type = 'lab'}})) do + storage.lab_inputs[entity_prototype.name] = util.list_to_map(entity_prototype.lab_inputs) end end @@ -12,14 +12,14 @@ script.on_configuration_changed(on_configuration_changed) local function on_created_entity(event) local entity = event.created_entity or event.entity or event.destination - global.structs[entity.unit_number] = { + storage.structs[entity.unit_number] = { -- unit_number = entity.unit_number, entity = entity, } end script.on_init(function(event) - global.structs = {} + storage.structs = {} on_configuration_changed() @@ -96,18 +96,18 @@ end local function get_missing_counts(force, list) local missing_counts = {} - for unit_number, struct in pairs(global.structs) do + for unit_number, struct in pairs(storage.structs) do if not struct.entity.valid then - global.structs[unit_number] = nil + storage.structs[unit_number] = nil else if struct.entity.force == force then if struct.entity.status == defines.entity_status.missing_science_packs then local inventory = struct.entity.get_inventory(defines.inventory.lab_input) if inventory.is_empty() == false then - + for _, item_name in ipairs(list) do - if global.lab_inputs[struct.entity.name][item_name] then -- ignore labs that cannot use this item + if storage.lab_inputs[struct.entity.name][item_name] then -- ignore labs that cannot use this item if inventory.get_item_count(item_name) == 0 then -- game.print(serpent.line({ -- item_name, diff --git a/mods/show-missing-bottles-for-current-research/data.lua b/mods_2.0/052_show-missing-bottles-for-current-research/data.lua similarity index 100% rename from mods/show-missing-bottles-for-current-research/data.lua rename to mods_2.0/052_show-missing-bottles-for-current-research/data.lua diff --git a/mods/show-missing-bottles-for-current-research/info.json b/mods_2.0/052_show-missing-bottles-for-current-research/info.json similarity index 80% rename from mods/show-missing-bottles-for-current-research/info.json rename to mods_2.0/052_show-missing-bottles-for-current-research/info.json index 1f105c7b..53bf5fbb 100644 --- a/mods/show-missing-bottles-for-current-research/info.json +++ b/mods_2.0/052_show-missing-bottles-for-current-research/info.json @@ -2,9 +2,9 @@ "name": "show-missing-bottles-for-current-research", "title": "Show missing bottles for current research", "description": "Research-kun why are you stuck?", - "version": "1.0.3", + "version": "2.0.0", "author": "Quezler", - "factorio_version": "1.1", + "factorio_version": "2.0", "dependencies": [ ] } diff --git a/mods/show-missing-bottles-for-current-research/thumbnail.png b/mods_2.0/052_show-missing-bottles-for-current-research/thumbnail.png similarity index 100% rename from mods/show-missing-bottles-for-current-research/thumbnail.png rename to mods_2.0/052_show-missing-bottles-for-current-research/thumbnail.png