mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-25 21:29:06 +02:00
Handle changes when git does callbacks
This commit is contained in:
parent
2a3eab8521
commit
af15c20445
@ -468,6 +468,12 @@ local collapse_after_wave_200 = function()
|
||||
end
|
||||
end
|
||||
|
||||
local handle_changes = function()
|
||||
WPT.set('restart', true)
|
||||
WPT.set('soft_reset', false)
|
||||
print('Received new changes from backend.')
|
||||
end
|
||||
|
||||
local on_tick = function()
|
||||
local update_gui = Gui_mf.update_gui
|
||||
local tick = game.tick
|
||||
@ -533,6 +539,8 @@ local on_init = function()
|
||||
Explosives.set_whitelist_entity('tank')
|
||||
end
|
||||
|
||||
Event.add(Server.events.on_changes_detected, handle_changes)
|
||||
|
||||
Event.on_nth_tick(10, on_tick)
|
||||
Event.on_init(on_init)
|
||||
Event.add(WPT.events.reset_map, Public.reset_map)
|
||||
|
@ -250,6 +250,12 @@ local function on_nth_tick(event)
|
||||
tick_actions[seconds]()
|
||||
end
|
||||
|
||||
local function handle_changes()
|
||||
ScenarioTable.set('restart', true)
|
||||
ScenarioTable.set('soft_reset', false)
|
||||
print('Received new changes from backend.')
|
||||
end
|
||||
|
||||
local function ui_smell_evolution()
|
||||
for _, player in pairs(game.connected_players) do
|
||||
-- Only for non-townies
|
||||
@ -276,6 +282,7 @@ Event.on_init(on_init)
|
||||
Event.on_nth_tick(60, on_nth_tick) -- once every second
|
||||
Event.on_nth_tick(60 * 30, ui_smell_evolution)
|
||||
Event.on_nth_tick(60, update_score)
|
||||
Event.add(Server.events.on_changes_detected, handle_changes)
|
||||
|
||||
--Disable the comfy main gui since we got too many goodies there.
|
||||
Event.add(
|
||||
|
Loading…
x
Reference in New Issue
Block a user