mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 15:04:52 +09:00
Fix crash when game starts tick_paused
Check patch number in update_instance step to ensure the clusterio_api is properly initialized if the game started tick paused and no ticks to trigger the patch check have happened yet.
This commit is contained in:
1 parent
475182efd0
commit
17e4b088f1
1 file changed
+7
-4
@@ -1,16 +1,18 @@
|
||||
local api = require('modules/clusterio/api')
|
||||
|
||||
local impl = {}
|
||||
|
||||
|
||||
impl.events = {}
|
||||
impl.events[defines.events.on_tick] = function()
|
||||
local function check_patch()
|
||||
if global.clusterio_patch_number ~= clusterio_patch_number then
|
||||
global.clusterio_patch_number = clusterio_patch_number
|
||||
script.raise_event(api.events.on_server_startup, {})
|
||||
end
|
||||
end
|
||||
|
||||
local impl = {}
|
||||
impl.events = {}
|
||||
|
||||
impl.events[defines.events.on_tick] = check_patch
|
||||
|
||||
impl.events[api.events.on_server_startup] = function()
|
||||
if not global.clusterio then
|
||||
global.clusterio = {
|
||||
@@ -47,6 +49,7 @@ end
|
||||
-- Internal API
|
||||
clusterio_private = {}
|
||||
function clusterio_private.update_instance(new_id, new_name)
|
||||
check_patch()
|
||||
global.clusterio.instance_id = new_id
|
||||
global.clusterio.instance_name = new_name
|
||||
script.raise_event(api.events.on_instance_updated, {
|
||||
|
||||
Reference in new issue
Block a user