mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-30 04:40:54 +02:00
Mtn v3 - minor fixes
This commit is contained in:
parent
b1476730d9
commit
dcf743cc37
@ -1384,7 +1384,7 @@ function Public.loco_died(invalid_locomotive)
|
||||
show_mvps(player)
|
||||
end
|
||||
|
||||
if not locomotive.valid then
|
||||
if not locomotive or not locomotive.valid then
|
||||
local this = Public.get()
|
||||
|
||||
local data = {}
|
||||
|
@ -133,6 +133,10 @@ function Public.locomotive_spawn(surface, position, reversed)
|
||||
local this = Public.get()
|
||||
local extra_wagons = Public.stateful.get_stateful('extra_wagons')
|
||||
|
||||
if not extra_wagons then
|
||||
extra_wagons = 0
|
||||
end
|
||||
|
||||
if reversed then
|
||||
position.y = position.y - (6 * extra_wagons)
|
||||
for y = -6, 6, 2 do
|
||||
|
@ -857,6 +857,9 @@ local function update_raw()
|
||||
end
|
||||
|
||||
local stateful = Public.get_stateful()
|
||||
if not stateful or not stateful.objectives then
|
||||
return
|
||||
end
|
||||
local breached_wall = Public.get('breached_wall')
|
||||
if not breached_wall then
|
||||
return
|
||||
|
@ -1093,7 +1093,9 @@ local apply_settings_token =
|
||||
this.season = settings.season
|
||||
|
||||
local current_season = Public.get('current_season')
|
||||
rendering.set_text(current_season, 'Season: ' .. this.season)
|
||||
if current_season then
|
||||
rendering.set_text(current_season, 'Season: ' .. this.season)
|
||||
end
|
||||
|
||||
this.objectives = {}
|
||||
|
||||
@ -1543,6 +1545,23 @@ function Public.enable(state)
|
||||
this.enabled = state or false
|
||||
end
|
||||
|
||||
function Public.stateful_on_server_started()
|
||||
if this.settings_applied then
|
||||
return
|
||||
end
|
||||
|
||||
local server_name_matches = Server.check_server_name('Mtn Fortress')
|
||||
|
||||
this.settings_applied = true
|
||||
|
||||
if server_name_matches then
|
||||
Server.try_get_data(dataset, dataset_key, apply_settings_token)
|
||||
else
|
||||
Server.try_get_data(dataset, dataset_key_dev, apply_settings_token)
|
||||
this.test_mode = true
|
||||
end
|
||||
end
|
||||
|
||||
Event.add(
|
||||
Server.events.on_server_started,
|
||||
function()
|
||||
|
@ -382,6 +382,13 @@ function Public.save_stateful_settings()
|
||||
end
|
||||
end
|
||||
|
||||
local init_mtn_token =
|
||||
Task.register(
|
||||
function()
|
||||
Public.init_mtn()
|
||||
end
|
||||
)
|
||||
|
||||
local apply_settings_token =
|
||||
Task.register(
|
||||
function(data)
|
||||
@ -400,7 +407,9 @@ local apply_settings_token =
|
||||
end
|
||||
end
|
||||
|
||||
Public.init_mtn()
|
||||
Public.stateful_on_server_started()
|
||||
|
||||
Task.set_timeout_in_ticks(2, init_mtn_token)
|
||||
end
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user