Fix Figura preview when game is paused

Works by setting local_state in player_init, then running refreshAll()
and manually setting cooldown in the same call instead of queueing it
for the next tick, which never happens if the game is paused.
This commit is contained in:
NullBite 2022-03-24 11:38:27 -04:00
parent 5d38f2110e
commit 2c59cbbefb
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -253,6 +253,13 @@ function setState(name, state)
end
-- Local State (these are copied by pings at runtime) --
function getLocalState()
local ret={}
for k, v in pairs(skin_state) do
ret[k]=v
end
return ret
end
local_state={}
-- }}}
@ -388,7 +395,7 @@ do
end
local function forceVanilla()
return can_modify_vanilla or local_state.vanilla_enabled
return not can_modify_vanilla or local_state.vanilla_enabled
end
-- eventually replace this with an instance once PartsManager becomes a class
@ -537,7 +544,8 @@ end
function syncState()
ping.setSnoring(skin_state.snore_enabled)
ping.syncState(skin_state)
local_state=getLocalState()
ping.syncState(local_state)
end
function ping.syncState(tbl)
@ -624,6 +632,10 @@ function player_init()
for k, v in pairs(reduce(mergeTable, map(recurseModelGroup, model))) do
v.setEnabled(true)
end
local_state=getLocalState()
if cooldown(1, "refreshAll") then
PartsManager.refreshAll()
end
syncState()
end
-- Initial configuration --