improved SE compat

This commit is contained in:
mamoniot
2022-12-23 20:48:20 -05:00
parent c1d2a3dab9
commit 96baf62c39
6 changed files with 5 additions and 9 deletions

1
TODO
View File

@@ -1,5 +1,4 @@
bugs:
fix crash in submitted massively modded world
check for bugs in new player's submitted world
find se bug https://mods.factorio.com/mod/cybersyn/discussion/639d1ea26f00ecfa7b048da0
https://mods.factorio.com/mod/cybersyn/discussion/63a52e54be4341bccc0446f8

View File

@@ -12,6 +12,8 @@ Date: 2022-12-23
- Made several alerts persistent
- Fixed bug with depot priority not working
- Fixed a memory leak relating to train layouts
- Fixed a rare crash when building stations
- Slightly improved compat with SE thanks to a bugfix in 0.6.94
---------------------------------------------------------------------------------------------------
Version: 1.1.7
Date: 2022-12-17

View File

@@ -8,7 +8,7 @@
"dependencies": [
"base",
"flib >= 0.6.0",
"? space-exploration >= 0.6.90",
"? space-exploration >= 0.6.94",
"? miniloader",
"? nullius",
"? pypostprocessing"

View File

@@ -21,7 +21,6 @@
---@field public economy Economy
---@field public each_refuelers {[uint]: true}
---@field public active_alerts {[uint]: {[1]: LuaTrain, [2]: int}}?
---@field public se_tele_old_id {[string]: uint}
---@class Station
---@field public entity_stop LuaEntity
@@ -150,9 +149,6 @@ function init_global()
global.each_refuelers = {}
IS_SE_PRESENT = remote.interfaces["space-exploration"] ~= nil
if IS_SE_PRESENT then
global.se_tele_old_id = {}
end
end
---@param v string

View File

@@ -695,7 +695,6 @@ local function setup_se_compat()
if not train then return end
--NOTE: IMPORTANT, until se_on_train_teleport_finished_event is called map_data.trains[old_id] will reference an invalid train entity; our events have either been set up to account for this or should be impossible to trigger until teleportation is finished
train.se_is_being_teleported = true
map_data.se_tele_old_id[train_unique_identifier] = old_id
interface_raise_train_teleport_started(old_id)
end)
---@param event {}
@@ -711,8 +710,7 @@ local function setup_se_compat()
--NOTE: event.old_train_id_1 from this event is useless, it's for one of the many transient trains SE spawns while teleporting the old train, only se_on_train_teleport_started_event returns the correct old train id
--NOTE: please SE dev if you read this fix the issue where se_on_train_teleport_finished_event is returning the wrong old train id
local old_id = map_data.se_tele_old_id[train_unique_identifier]
map_data.se_tele_old_id[train_unique_identifier] = nil
local old_id = event.old_train_id_1
local train = map_data.trains[old_id]
if not train then return end

View File

@@ -121,6 +121,7 @@ local migrations_table = {
map_data.tick_data = {}
map_data.each_refuelers = {}
map_data.se_tele_old_id = nil
for k, comb in pairs(map_data.to_comb) do
local control = get_comb_control(comb)