fix proxies using Hide not cleaning up properly when hidden

This commit is contained in:
CapsAdmin 2022-03-05 09:33:06 +01:00
parent fb4ef19b40
commit d04c417752
2 changed files with 34 additions and 0 deletions

View File

@ -636,6 +636,28 @@ do -- hidden / events
end
end
function PART:GetReasonHidden()
local found = {}
for part in pairs(self.active_events) do
table.insert(found, tostring(part) .. " is event hiding")
end
if found[1] then
return table.concat(found, "\n")
end
if self.Hide then
return "hide enabled"
end
if self.hide_disturbing then
return "pac_hide_disturbing is set to 1"
end
return ""
end
function PART:CalcShowHide(from_rendering)
local b = self:IsHidden()

View File

@ -809,6 +809,18 @@ function PART:OnHide()
self.last_pos = nil
self.last_vel_smooth = nil
end
if self.VariableName == "Hide" then
-- cleanup event triggers on hide
local part = self:GetTarget()
if self.AffectChildren then
for _, part in ipairs(self:GetChildren()) do
part:SetEventTrigger(self, false)
end
else
part:SetEventTrigger(self, false)
end
end
end
function PART:OnShow()