Skip to content

Commit

Permalink
Migrate abandoned upcycler input chests
Browse files Browse the repository at this point in the history
  • Loading branch information
Quezler committed Dec 31, 2024
1 parent e49326c commit 0ccc7e9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mods_2.0/010_upcycler/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.1.4
Date: 2024. 12. 31
Info:
- Migrate abandoned upcycler input chests
---------------------------------------------------------------------------------------------------
Version: 1.1.3
Date: 2024. 12. 30
Info:
Expand Down
28 changes: 28 additions & 0 deletions mods_2.0/010_upcycler/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function Handler.init()

Handler.reset_on_created_entity_listeners()
init_epd_event()

storage.ran_migration_1_1_4 = true
end

function Handler.on_configuration_changed()
Expand All @@ -60,6 +62,32 @@ function Handler.on_configuration_changed()

reset_items_per_next_quality()
Handler.reset_on_created_entity_listeners()

if storage.ran_migration_1_1_4 ~= true then
storage.ran_migration_1_1_4 = true

for _, surface in pairs(game.surfaces) do
if surface.name ~= mod_surface_name then
for _, entity in pairs(surface.find_entities_filtered{name = "upcycler-input"}) do
local found_an_upcycler = false
-- if prototypes.entity["upcycler"] and surface.find_entity("upcycler", entity.position) then
-- found_an_upcycler = true
-- end
-- if prototypes.entity["burner-upcycler"] and surface.find_entity("burner-upcycler", entity.position) then
-- found_an_upcycler = true
-- end
for upcycler_name, _ in pairs(storage.items_per_next_quality) do
if surface.find_entity("upcycler", entity.position) then
found_an_upcycler = true
end
end
if found_an_upcycler == false then
entity.destroy()
end
end
end
end
end
end

script.on_init(Handler.init)
Expand Down
2 changes: 1 addition & 1 deletion mods_2.0/010_upcycler/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Upcycler",
"description": "No quality modules, sacrifice x (configurable) items to get the next tier.",

"version": "1.1.3",
"version": "1.1.4",
"author": "Quezler",
"factorio_version": "2.0",

Expand Down

0 comments on commit 0ccc7e9

Please sign in to comment.