File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -645,6 +645,7 @@ function pac.EnablePartsByClass(classname, enable)
645645 end
646646end
647647
648+ local known_special_link_parts = {}
648649function pac .LinkSpecialTrackedPartsForEvent (part , ply )
649650 part .erroring_cached_parts = {}
650651 part .found_cached_parts = {}
@@ -654,11 +655,27 @@ function pac.LinkSpecialTrackedPartsForEvent(part, ply)
654655 [" damage_zone" ] = true ,
655656 [" lock" ] = true
656657 }
658+ known_special_link_parts [ply ] = known_special_link_parts [ply ] or {}
659+ known_special_link_parts [ply ][part ] = part .specialtrackedparts
657660 for _ ,part2 in pairs (all_parts ) do
658661 if ply == part2 :GetPlayerOwner () and tracked_classes [part2 .ClassName ] then
659662 table.insert (part .specialtrackedparts ,part2 )
660663 end
661664 end
665+ known_special_link_parts [ply ][part ] = part .specialtrackedparts
666+ end
667+ function pac .InsertSpecialTrackedPart (ply , append_part , remove )
668+ if append_part then
669+ if known_special_link_parts [ply ] then
670+ for part ,tbl in pairs (known_special_link_parts [ply ]) do
671+ if remove then table .RemoveByValue (part .specialtrackedparts , append_part ) continue end
672+ if part :IsValid () then
673+ table.insert (part .specialtrackedparts , append_part )
674+ end
675+ end
676+ end
677+ return
678+ end
662679end
663680
664681-- a centralized function to cache a part in a prebuilt list so we can access relevant parts already narrowed down instead of searching through all parts / localparts
Original file line number Diff line number Diff line change @@ -998,6 +998,8 @@ function PART:OnRemove()
998998 pac .RemoveHook (v , " pace_draw_hitbox" )
999999 end
10001000 self :ClearHitMarkers ()
1001+ -- remove itself
1002+ pac .InsertSpecialTrackedPart (self :GetPlayerOwner (), self , true )
10011003end
10021004
10031005local previousRenderingHook
@@ -1295,6 +1297,7 @@ function PART:Initialize()
12951297 end
12961298 end )
12971299
1300+ pac .InsertSpecialTrackedPart (self :GetPlayerOwner (), self )
12981301end
12991302
13001303function PART :SetRadius (val )
Original file line number Diff line number Diff line change @@ -478,6 +478,7 @@ function PART:reset_ent_ang()
478478end
479479
480480function PART :OnRemove ()
481+ pac .InsertSpecialTrackedPart (self :GetPlayerOwner (), self , true )
481482end
482483
483484function PART :DecideTarget ()
@@ -595,6 +596,7 @@ function PART:Initialize()
595596 end
596597 end
597598 if not convar_lock :GetBool () then self :SetError (" lock parts are disabled on this server!" ) end
599+ pac .InsertSpecialTrackedPart (self :GetPlayerOwner (), self )
598600end
599601
600602
You can’t perform that action at this time.
0 commit comments