added null check

This commit is contained in:
mamoniot
2022-12-23 21:02:56 -05:00
parent 96baf62c39
commit 5adf211342

View File

@@ -181,6 +181,7 @@ function set_manifest_schedule(map_data, train, depot_name, d_surface_i, p_stop,
if (is_p_on_t or p_surface_i == other_surface_i) and (is_r_on_t or r_surface_i == other_surface_i) and (is_d_on_t or d_surface_i == other_surface_i) then
local t_zone = remote.call("space-exploration", "get_zone_from_surface_index", {surface_index = t_surface_i})--[[@as {}]]
local other_zone = remote.call("space-exploration", "get_zone_from_surface_index", {surface_index = other_surface_i})--[[@as {}]]
if t_zone and other_zone then
local is_train_in_orbit = other_zone.orbit_index == t_zone.index
if is_train_in_orbit or t_zone.orbit_index == other_zone.index then
local elevator_name = se_get_space_elevator_name(t_surface)
@@ -217,6 +218,7 @@ function set_manifest_schedule(map_data, train, depot_name, d_surface_i, p_stop,
end
end
end
end
--NOTE: create a schedule that cannot be fulfilled, the train will be stuck but it will give the player information what went wrong
train.schedule = {current = 1, records = {
create_inactivity_order(depot_name),