added debug revision numbers

This commit is contained in:
mamoniot
2023-03-29 16:32:51 -04:00
parent ae287209a4
commit 7b41bf9746
2 changed files with 38 additions and 2 deletions

6
cybersyn/info.lua Normal file
View File

@@ -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

View File

@@ -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