mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-09 02:08:13 -06:00
fixed handling of network_name
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
---@field public is_available true?
|
---@field public is_available true?
|
||||||
---@field public parked_at_depot_id uint?
|
---@field public parked_at_depot_id uint?
|
||||||
---@field public depot_name string
|
---@field public depot_name string
|
||||||
---@field public network_name string
|
---@field public network_name string? --can only be nil when the train is parked at a depot
|
||||||
---@field public network_flag int
|
---@field public network_flag int
|
||||||
---@field public priority int
|
---@field public priority int
|
||||||
---@field public se_depot_surface_i uint --se only
|
---@field public se_depot_surface_i uint --se only
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ end
|
|||||||
---@param train Train
|
---@param train Train
|
||||||
function remove_available_train(map_data, train_id, train)
|
function remove_available_train(map_data, train_id, train)
|
||||||
---@type uint
|
---@type uint
|
||||||
if train.is_available then
|
if train.is_available and train.network_name then
|
||||||
local network = map_data.available_trains[train.network_name--[[@as string]]]
|
local network = map_data.available_trains[train.network_name--[[@as string]]]
|
||||||
if network then
|
if network then
|
||||||
network[train_id] = nil
|
network[train_id] = nil
|
||||||
|
|||||||
@@ -154,16 +154,15 @@ local migrations_table = {
|
|||||||
v.se_is_being_teleported = not v.entity and true or nil
|
v.se_is_being_teleported = not v.entity and true or nil
|
||||||
--NOTE: we are guessing here because this information was never saved
|
--NOTE: we are guessing here because this information was never saved
|
||||||
v.se_depot_surface_i = v.entity.front_stock.surface.index
|
v.se_depot_surface_i = v.entity.front_stock.surface.index
|
||||||
if v.parked_at_depot_id then
|
v.is_available = nil
|
||||||
v.is_available = true
|
if v.parked_at_depot_id and v.network_name then
|
||||||
local network = map_data.available_trains[v.network_name--[[@as string]]]
|
local network = map_data.available_trains[v.network_name--[[@as string]]]
|
||||||
if not network then
|
if not network then
|
||||||
network = {}
|
network = {}
|
||||||
map_data.available_trains[v.network_name--[[@as string]]] = network
|
map_data.available_trains[v.network_name--[[@as string]]] = network
|
||||||
end
|
end
|
||||||
network[id] = true
|
network[id] = true
|
||||||
else
|
v.is_available = true
|
||||||
v.is_available = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user