From 2c59cbbefba1c061860640681fb9295180eb9b45 Mon Sep 17 00:00:00 2001 From: NullBite Date: Thu, 24 Mar 2022 11:38:27 -0400 Subject: [PATCH] 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. --- script.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/script.lua b/script.lua index 80184d7..5191d85 100644 --- a/script.lua +++ b/script.lua @@ -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 --