From 3db9cded3efbc8dfc94d75ca61c6a5b658d1ba39 Mon Sep 17 00:00:00 2001 From: NullBite Date: Tue, 5 Apr 2022 20:34:35 -0400 Subject: [PATCH] Move pm_refresh check to function --- script.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/script.lua b/script.lua index 2a7f478..2847000 100644 --- a/script.lua +++ b/script.lua @@ -295,9 +295,18 @@ function syncState() ping.syncState(setLocalState()) end -pm_refresh=false -function pmRefresh() - pm_refresh=true +do + local pm_refresh=false + function pmRefresh() + pm_refresh=true + end + + function doPmRefresh() + if pm_refresh then + PartsManager.refreshAll() + pm_refresh=false + end + end end function ping.syncState(tbl) @@ -1126,10 +1135,7 @@ function tick() animateTick() -- Check for queued PartsManager refresh - if pm_refresh then - PartsManager.refreshAll() - pm_refresh=false - end + doPmRefresh() -- End of tick -- old_state.health=player.getHealth() old_state.color_check=color_check