Skip to content

Commit

Permalink
corrected fix for crash when removing demo mod of #992
Browse files Browse the repository at this point in the history
  • Loading branch information
LovelySanta committed Oct 8, 2024
1 parent 477824c commit daad898
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions angelsrefining/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
28 changes: 28 additions & 0 deletions angelsrefining/src/mod-config.lua
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit daad898

Please sign in to comment.