Refactor PartsManager refresh
This commit is contained in:
parent
d7e94063fb
commit
8903ef3029
20
script.lua
20
script.lua
@ -269,8 +269,18 @@ function syncState()
|
|||||||
ping.syncState(setLocalState())
|
ping.syncState(setLocalState())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local pm_refresh=false
|
||||||
function pmRefresh()
|
function pmRefresh()
|
||||||
rateLimit(1, PartsManager.refreshAll, "refreshAll")
|
pm_refresh=true
|
||||||
|
end
|
||||||
|
|
||||||
|
function doPmRefresh()
|
||||||
|
if pm_refresh then
|
||||||
|
PartsManager.refreshAll()
|
||||||
|
pm_refresh=false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ping.syncState(tbl)
|
function ping.syncState(tbl)
|
||||||
@ -645,16 +655,12 @@ function animateTail(val)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function tick()
|
function tick()
|
||||||
if not refreshed then
|
|
||||||
cooldown(1, "refreshAll")
|
|
||||||
PartsManager.refreshAll()
|
|
||||||
refreshed=true
|
|
||||||
end
|
|
||||||
|
|
||||||
if world.getTime() % (20*10) == 0 then
|
if world.getTime() % (20*10) == 0 then
|
||||||
syncState()
|
syncState()
|
||||||
end
|
end
|
||||||
animateTick()
|
animateTick()
|
||||||
|
|
||||||
|
doPmRefresh()
|
||||||
end
|
end
|
||||||
|
|
||||||
function render(delta)
|
function render(delta)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user