more reliable TPIKPos (shouldnt break for other players/mirrors)

This commit is contained in:
Darsu 2024-11-02 16:57:35 +07:00
parent 4820bed09d
commit 5a525ef8fc
2 changed files with 16 additions and 8 deletions

View File

@ -379,8 +379,6 @@ function SWEP:SetupModel(wm, lod, cm)
csmodel:SetNoDraw(true)
csmodel.atttbl = {}
local shouldtpik = self:ShouldTPIK()
if cm then
csmodel.slottbl = {
@ -391,8 +389,8 @@ function SWEP:SetupModel(wm, lod, cm)
else
csmodel.slottbl = {
WMBase = true,
Pos = (shouldtpik and self.WorldModelOffset.TPIKPos) or self.WorldModelOffset.Pos or Vector(0, 0, 0),
Ang = (shouldtpik and self.WorldModelOffset.TPIKAng) or self.WorldModelOffset.Ang or Angle(-5, 0, 180)
Pos = self.WorldModelOffset.Pos or Vector(0, 0, 0),
Ang = self.WorldModelOffset.Ang or Angle(-5, 0, 180)
}
end

View File

@ -20,15 +20,25 @@ function SWEP:ShouldTPIK()
if self:ShouldLOD() == 2 then return end
-- if self:GetSafe() then return end
-- if self:GetBlindFireAmount() > 0 then return false end
if lp == owner and !owner:ShouldDrawLocalPlayer() then return end
-- if lp == owner and !owner:ShouldDrawLocalPlayer() then return end
if self:RunHook("Hook_BlockTPIK") then return end
-- if !arc9_tpik:GetBool() then return false end
local should = false
if lp != owner then
return arc9_tpik:GetBool() and arc9_tpik_others:GetBool()
should = arc9_tpik:GetBool() and arc9_tpik_others:GetBool()
else
return arc9_tpik:GetBool()
should = arc9_tpik:GetBool()
end
-- return false
local wm = self:GetWM()
if IsValid(wm) and wm.slottbl then
wm.slottbl.Pos = (should and self.WorldModelOffset.TPIKPos) or self.WorldModelOffset.Pos
wm.slottbl.Ang = (should and self.WorldModelOffset.TPIKAng) or self.WorldModelOffset.Ang
end
return should
end
SWEP.TPIKCache = {}