diff --git a/angelsrefining/control.lua b/angelsrefining/control.lua index 9645248bd..2b6457ec5 100644 --- a/angelsrefining/control.lua +++ b/angelsrefining/control.lua @@ -4,6 +4,8 @@ local ground_water_pump = require("src.ground_water_pump") local sea_pump = require("src.sea-pump") -- initialisation +local on_configuration_changed = require("src.mod-config") +script.on_configuration_changed(on_configuration_changed) script.on_init(function() starting_items:on_init() sea_pump:on_init() diff --git a/angelsrefining/src/mod-config.lua b/angelsrefining/src/mod-config.lua new file mode 100644 index 000000000..bdc4688be --- /dev/null +++ b/angelsrefining/src/mod-config.lua @@ -0,0 +1,28 @@ +local sea_pump = require("src.sea-pump") + +return function(configuration_data) + local mod_changes = configuration_data.mod_changes["angelspump"] + if mod_changes and mod_changes.new_version ~= (mod_changes.old_version or "") then + log( + string.format( + "Updating angelspump from version %q to version %q", + mod_changes.old_version or "nil", + mod_changes.new_version + ) + ) + + -------------------------------------------------- + -- Sea pump script----- -- + -------------------------------------------------- + if not global.SP_data then + log("Updating sea pump from version 0 to latest version.") + sea_pump:on_init() + end + + if global.SP_data.version == 1 then + log("Updating sea pump from version 1 to version 2.") + global.SP_data["entity_modules_data_tag"] = "sea-pump-modules_request" -- the tag name where the data is stored in the entity + global.SP_data.version = 2 + end + end +end