From 4d8e6d8c99939b50f7ebe7037689838c46dfd09f Mon Sep 17 00:00:00 2001 From: TW1STaL1CKY Date: Sun, 16 Feb 2025 20:40:57 +0000 Subject: [PATCH] Prevent multiple clip parts calling SetupBones on the same model --- lua/pac3/core/client/parts/clip.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/pac3/core/client/parts/clip.lua b/lua/pac3/core/client/parts/clip.lua index 08d09d3a..7dda463a 100644 --- a/lua/pac3/core/client/parts/clip.lua +++ b/lua/pac3/core/client/parts/clip.lua @@ -42,7 +42,11 @@ do -- this fixes clip planes lagging behind when parented to a bone on a model part local owner = self:GetParentOwner() - if owner:IsValid() and owner.PACPart then + if owner:IsValid() and not owner.pac_clip_bonessetup and owner.PACPart then + -- in case there are multiple clips on one model part, only the first one needs to call SetupBones + self.pac_clip_owner = owner + owner.pac_clip_bonessetup = true + pac.SetupBones(owner) end @@ -55,6 +59,11 @@ do local render_PopCustomClipPlane = render.PopCustomClipPlane function PART:PostOnDraw() + if self.pac_clip_owner then + self.pac_clip_owner.pac_clip_bonessetup = nil + self.pac_clip_owner = nil + end + render_PopCustomClipPlane() render_EnableClipping(bclip)