Skip to content

Commit

Permalink
Remove double isvalid check
Browse files Browse the repository at this point in the history
  • Loading branch information
wrefgtzweve committed Dec 9, 2023
1 parent ed4d272 commit 75f090a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lua/pac3/core/client/base_movable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ do -- bones

function PART:GetBoneMatrix()
local parent = self:GetParent()
if parent:IsValid() or IsValid(parent) then
if IsValid(parent) then
if parent.ClassName == "jiggle" or parent.ClassName == "interpolated_multibone" then
local bone_matrix = Matrix()
if parent.pos then
Expand Down Expand Up @@ -189,7 +189,7 @@ function PART:CalcAngles(ang, wpos)

return self.Angles + (pac.EyePos - wpos):Angle()
end

local function get_nearest_ent(part)
local nearest_ent = part:GetRootPart():GetOwner()
local nearest_dist = math.huge
Expand All @@ -213,12 +213,12 @@ function PART:CalcAngles(ang, wpos)
local ang = (nearest_ent:GetPos() - wpos):Angle()
return Angle(0,ang.y,0) + self.Angles
end

if pac.StringFind(self.AimPartName, "NEAREST_LIFE_POS", true, true) then
local nearest_ent = get_nearest_ent(self)
return self.Angles + (nearest_ent:GetPos() - wpos):Angle()
end

if pac.StringFind(self.AimPartName, "NEAREST_LIFE", true, true) then
local nearest_ent = get_nearest_ent(self)
return self.Angles + ( nearest_ent:GetPos() + Vector(0,0,(nearest_ent:WorldSpaceCenter() - nearest_ent:GetPos()).z * 1.5) - wpos):Angle()
Expand Down

0 comments on commit 75f090a

Please sign in to comment.