attempted fix

This commit is contained in:
Monica Moniot
2022-12-03 21:20:18 -05:00
parent 32ba29c55f
commit 5462beb198
2 changed files with 80 additions and 77 deletions

View File

@@ -98,8 +98,8 @@
---@alias cybersyn.global MapData
---@type CybersynModSettings
mod_settings = {}
IS_SE_PRESENT = remote.interfaces["space-exploration"] ~= nil
---@type boolean
IS_SE_PRESENT = nil
function init_global()
global.total_ticks = 0
@@ -124,6 +124,7 @@ function init_global()
global.layout_train_count = {}
global.layout_top_id = 1
IS_SE_PRESENT = remote.interfaces["space-exploration"] ~= nil
if IS_SE_PRESENT then
global.se_tele_old_id = {}
end

View File

@@ -1017,12 +1017,14 @@ local function main()
script.on_configuration_changed(on_config_changed)
if IS_SE_PRESENT then
script.on_load(function()
IS_SE_PRESENT = remote.interfaces["space-exploration"] ~= nil
if not IS_SE_PRESENT then return end
local se_on_train_teleport_finished_event = remote.call("space-exploration", "get_on_train_teleport_finished_event")
local se_on_train_teleport_started_event = remote.call("space-exploration", "get_on_train_teleport_started_event")
---@param event {}
script.on_event(se_on_train_teleport_started_event, function(event)
---@type MapData
local map_data = global
@@ -1038,6 +1040,7 @@ local function main()
map_data.se_tele_old_id[train_unique_identifier] = old_id
interface_raise_train_teleport_started(old_id)
end)
---@param event {}
script.on_event(se_on_train_teleport_finished_event, function(event)
---@type MapData
local map_data = global
@@ -1106,7 +1109,6 @@ local function main()
end)
end)
end
end
main()