Skip to content

Commit 05878b0

Browse files
ByakuyaKuchikie2pingu7867
authored andcommitted
bc cedric forgets to add nil checks
1 parent f59db31 commit 05878b0

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

lua/pac3/core/client/parts/damage_zone.lua

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ function PART:LaunchAuditAndEnforceSoftBan(amount, reason)
180180
return
181181
end
182182
local owner = self:GetPlayerOwner()
183+
if not IsValid(owner) then return end
184+
183185
if owner ~= LocalPlayer() then return end
184186
owner.stop_hit_markers_admonishment_count = owner.stop_hit_markers_admonishment_count or 1
185187
owner.stop_hit_markers_admonishment_message_up = false
@@ -513,6 +515,8 @@ function PART:ClearHitMarkers()
513515
if IsValid(part) then part:GetRootOwner():Remove() end
514516
end
515517
local ply = self:GetPlayerOwner()
518+
if not IsValid(ply) then return end --CMON CEDRIC. IT'S THIS EASY
519+
516520
if ply.hitparts then
517521
for i,v in pairs(ply.hitparts) do
518522
v.specimen_part:Remove()
@@ -741,12 +745,15 @@ function PART:LegacyAttachToEntity(part, ent)
741745

742746
local tbl = part:ToTable()
743747

744-
local group = pac.CreatePart("group", self:GetPlayerOwner())
748+
local ply = self:GetPlayerOwner()
749+
if not IsValid(ply) then return end
750+
751+
local group = pac.CreatePart("group", ply)
745752
table.insert(hitparts_dump, {self, group, ent})
746753
self.force_cleanup_hitparts = CurTime() + math.max(self.HitMarkerLifetime, self.KillMarkerLifetime)
747754
group:SetShowInEditor(false)
748755

749-
local part_clone = pac.CreatePart(tbl.self.ClassName, self:GetPlayerOwner(), tbl, tostring(tbl))
756+
local part_clone = pac.CreatePart(tbl.self.ClassName, ply, tbl, tostring(tbl))
750757
group:AddChild(part_clone)
751758

752759
group:SetOwner(ent)
@@ -797,6 +804,7 @@ net.Receive("pac_hit_results", function(len)
797804

798805
local pos = self:GetWorldPosition()
799806
local owner = self:GetPlayerOwner()
807+
if not IsValid(owner) then return end
800808

801809
--START_BS_MOD
802810
--Octo 3/32026
@@ -1026,6 +1034,10 @@ function PART:PreviewHitbox()
10261034
if not self.Preview then pac.RemoveHook(self.RenderingHook, "pace_draw_hitbox"..self.UniqueID) end
10271035
if not IsValid(self) then pac.RemoveHook(self.RenderingHook, "pace_draw_hitbox"..self.UniqueID) end
10281036
self:GetWorldPosition()
1037+
1038+
local ply = self:GetPlayerOwner()
1039+
if not IsValid(ply) then return end
1040+
10291041
if self.HitboxMode == "Box" then
10301042
local mins = Vector(-self.Radius, -self.Radius, -self.Length)
10311043
local maxs = Vector(self.Radius, self.Radius, self.Length)
@@ -1047,7 +1059,8 @@ function PART:PreviewHitbox()
10471059
cam.PushModelMatrix( mat )
10481060
obj:Draw()
10491061
cam.PopModelMatrix()
1050-
if LocalPlayer() == self:GetPlayerOwner() then
1062+
1063+
if LocalPlayer() == ply then
10511064
if self.Radius ~= 0 then
10521065
local sides = self.Detail
10531066
if self.Detail < 1 then sides = 1 end
@@ -1122,7 +1135,7 @@ function PART:PreviewHitbox()
11221135
cam.PushModelMatrix( mat )
11231136
obj:Draw()
11241137
cam.PopModelMatrix()
1125-
if LocalPlayer() == self:GetPlayerOwner() then
1138+
if LocalPlayer() == ply then
11261139
if self.Radius ~= 0 then
11271140
local sides = self.Detail
11281141
if self.Detail < 1 then sides = 1 end

0 commit comments

Comments
 (0)