mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-07 20:08:02 -06:00
Merge pull request #74 from mamoniot/beta-on-nth-tick-collision-fix
Fix edge case where manager script.on_nth_tick could clobber main scr…
This commit is contained in:
@@ -847,17 +847,26 @@ local function grab_all_settings()
|
|||||||
end
|
end
|
||||||
local function register_tick()
|
local function register_tick()
|
||||||
script.on_nth_tick(nil)
|
script.on_nth_tick(nil)
|
||||||
if mod_settings.tps > DELTA then
|
--edge case catch to register both main and manager tick if they're scheduled to run on the same ticks
|
||||||
local nth_tick_main = ceil(60/mod_settings.tps)--[[@as uint]]
|
if mod_settings.manager_enabled and mod_settings.manager_ups == mod_settings.tps and mod_settings.tps > DELTA then
|
||||||
script.on_nth_tick(nth_tick_main, function()
|
local nth_tick = ceil(60/mod_settings.tps)
|
||||||
|
script.on_nth_tick(nth_tick, function()
|
||||||
tick(global, mod_settings)
|
tick(global, mod_settings)
|
||||||
end)
|
|
||||||
end
|
|
||||||
if mod_settings.manager_enabled and mod_settings.manager_ups > DELTA then
|
|
||||||
local nth_tick_manager = ceil(60/mod_settings.manager_ups)--[[@as uint]]
|
|
||||||
script.on_nth_tick(nth_tick_manager, function()
|
|
||||||
manager.tick(global)
|
manager.tick(global)
|
||||||
end)
|
end)
|
||||||
|
else
|
||||||
|
if mod_settings.tps > DELTA then
|
||||||
|
local nth_tick_main = ceil(60/mod_settings.tps)--[[@as uint]]
|
||||||
|
script.on_nth_tick(nth_tick_main, function()
|
||||||
|
tick(global, mod_settings)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if mod_settings.manager_enabled and mod_settings.manager_ups > DELTA then
|
||||||
|
local nth_tick_manager = ceil(60/mod_settings.manager_ups)--[[@as uint]]
|
||||||
|
script.on_nth_tick(nth_tick_manager, function()
|
||||||
|
manager.tick(global)
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function on_settings_changed(event)
|
local function on_settings_changed(event)
|
||||||
|
|||||||
Reference in New Issue
Block a user