diff --git a/cybersyn/info.lua b/cybersyn/info.lua new file mode 100644 index 0000000..860f838 --- /dev/null +++ b/cybersyn/info.lua @@ -0,0 +1,6 @@ + +--- The number below is the debug revision number. +--- It is used in migrations.lua to determine if any migrations need to be run for beta testers. +--- It is expected these are only meaningful between releases during beta testing. +--- It should be set to nil for any release version. +return 1 diff --git a/cybersyn/scripts/migrations.lua b/cybersyn/scripts/migrations.lua index 5498059..b14c890 100644 --- a/cybersyn/scripts/migrations.lua +++ b/cybersyn/scripts/migrations.lua @@ -1,6 +1,8 @@ --By Mami local flib_migration = require("__flib__.migration") local manager_gui = require('gui.main') +local debug_revision = require('info') +local check_debug_revision local migrations_table = { @@ -298,7 +300,9 @@ local migrations_table = { ---@type MapData local map_data = global - manager_gui.on_init() + map_data.manager = { + players = {}, + } for i, v in pairs(game.players) do manager_gui.on_player_created({player_index = i}) end @@ -318,7 +322,6 @@ local migrations_table = { end, } --STATUS_R_TO_D = 5 - ---@param data ConfigurationChangedData function on_config_changed(data) global.tick_state = STATE_INIT @@ -333,4 +336,31 @@ function on_config_changed(data) if IS_SE_PRESENT and not global.se_tele_old_id then global.se_tele_old_id = {} end + if global.debug_revision ~= debug_revision then + global.debug_revision = debug_revision + if debug_revision then + on_debug_revision_change() + end + end +end + +---NOTE: this runs before on_config_changed +---It does not have access to game +function on_debug_revision_change() + local map_data = global + + if debug_revision == 1 then + for _, e in pairs(map_data.refuelers) do + e.network_mask = e.network_flag + e.network_flag = nil + end + for _, e in pairs(map_data.stations) do + e.network_mask = e.network_flag + e.network_flag = nil + end + for _, e in pairs(map_data.trains) do + e.network_mask = e.network_flag + e.network_flag = nil + end + end end