Remove unnecessary PartsManager refreshes

This commit is contained in:
NullBite 2022-03-25 14:17:25 -04:00
parent af40621ad0
commit 625e784c57
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -621,9 +621,7 @@ function pmRefresh()
end end
function ping.syncState(tbl) function ping.syncState(tbl)
for k, v in pairs(tbl) do local_state=tbl
local_state[k]=v
end
pmRefresh() pmRefresh()
end end
@ -740,46 +738,52 @@ function armor()
local boots = string.sub(boots_item.getType(), 11, -7) local boots = string.sub(boots_item.getType(), 11, -7)
if local_state.armor_enabled then if local_state.armor_enabled then
-- leggings if old_state.leggings ~= leggings then
armor_glint.leggings=leggings_item.hasGlint() -- leggings
local leggings_color=colorArmor(leggings_item) or armor_color[leggings] armor_glint.leggings=leggings_item.hasGlint()
local uv=tailuvm:getUV(leggings) local leggings_color=colorArmor(leggings_item) or armor_color[leggings]
if uv ~= nil then local uv=tailuvm:getUV(leggings)
armor_state.leggings=true if uv ~= nil then
for k, v in pairs(TAIL_LEGGINGS) do armor_state.leggings=true
v.setUV(uv) for k, v in pairs(TAIL_LEGGINGS) do
end v.setUV(uv)
if leggings=="leather" then end
for k, v in pairs(TAIL_LEGGINGS_COLOR) do if leggings=="leather" then
v.setColor(leggings_color) for k, v in pairs(TAIL_LEGGINGS_COLOR) do
v.setColor(leggings_color)
end
else
for k, v in pairs(TAIL_LEGGINGS) do
v.setColor({1, 1, 1})
end
end end
else else
for k, v in pairs(TAIL_LEGGINGS) do armor_state.leggings=false
v.setColor({1, 1, 1})
end
end end
else pmRefresh()
armor_state.leggings=false
end end
-- boots if old_state.boots ~= boots then
armor_glint.boots=boots_item.hasGlint() -- boots
local boots_color=colorArmor(boots_item) or armor_color[boots] armor_glint.boots=boots_item.hasGlint()
local uv_boots=tailuvm:getUV(boots) local boots_color=colorArmor(boots_item) or armor_color[boots]
if uv_boots ~= nil then local uv_boots=tailuvm:getUV(boots)
armor_state.boots=true if uv_boots ~= nil then
for k, v in pairs(TAIL_BOOTS) do armor_state.boots=true
v.setUV(uv_boots) for k, v in pairs(TAIL_BOOTS) do
end v.setUV(uv_boots)
if boots=="leather" then end
model.Body.MTail1.MTail2.MTail3.Boot.setColor(boots_color) if boots=="leather" then
armor_state.leather_boots=true model.Body.MTail1.MTail2.MTail3.Boot.setColor(boots_color)
armor_state.leather_boots=true
else
model.Body.MTail1.MTail2.MTail3.Boot.setColor({1, 1, 1})
armor_state.leather_boots=false
end
else else
model.Body.MTail1.MTail2.MTail3.Boot.setColor({1, 1, 1}) armor_state.boots=false
armor_state.leather_boots=false
end end
else pmRefresh()
armor_state.boots=false
end end
else else
armor_glint.leggings=false armor_glint.leggings=false
@ -873,9 +877,6 @@ function player_init()
v.setEnabled(true) v.setEnabled(true)
end end
local_state=getLocalState() local_state=getLocalState()
if cooldown(1, "refreshAll") then
PartsManager.refreshAll()
end
syncState() syncState()
end end
-- Initial configuration -- -- Initial configuration --
@ -930,8 +931,6 @@ function tick()
cooldown(1, "refreshAll") cooldown(1, "refreshAll")
PartsManager.refreshAll() PartsManager.refreshAll()
refreshed=true refreshed=true
else
pmRefresh()
end end
updateTailVisibility() updateTailVisibility()