Fixing UndisguiseSilent (how did I not notice that?) and 3rd person crashing game on death.
parent
dde7e30d6d
commit
6c636543ad
|
@ -30,6 +30,8 @@
|
|||
hook.Add("CalcView", "Disguiser.ThirdPersonCalcView", function(player, pos, angles, fov)
|
||||
local smoothscale = 1
|
||||
|
||||
if !IsValid(player) then return end
|
||||
|
||||
if player:GetNetworkedBool("thirdperson") then
|
||||
angles = player:GetAimVector():Angle()
|
||||
|
||||
|
@ -54,7 +56,6 @@ hook.Add("CalcView", "Disguiser.ThirdPersonCalcView", function(player, pos, angl
|
|||
end
|
||||
|
||||
// smoothing - approaches a bit more slowly to the actual target position
|
||||
pos = targetpos
|
||||
pos = Vector(
|
||||
math.Approach(pos.x, targetpos.x, math.abs(targetpos.x - pos.x) * smoothscale),
|
||||
math.Approach(pos.y, targetpos.y, math.abs(targetpos.y - pos.y) * smoothscale),
|
||||
|
@ -92,10 +93,11 @@ end)
|
|||
|
||||
hook.Add("HUDPaint", "Disguiser.ThirdPersonHUDPaint", function()
|
||||
local player = LocalPlayer()
|
||||
if !player:GetNetworkedBool("thirdperson") then
|
||||
if !IsValid(player) then
|
||||
return
|
||||
end
|
||||
|
||||
if player:GetNetworkedBool("thirdperson") && player:Alive() then
|
||||
// trace from muzzle to hit pos
|
||||
local t = {}
|
||||
t.start = player:GetShootPos()
|
||||
|
@ -126,6 +128,7 @@ hook.Add("HUDPaint", "Disguiser.ThirdPersonHUDPaint", function()
|
|||
surface.DrawLine(pos.x, pos.y + offset, pos.x, pos.y + offset2)
|
||||
surface.DrawLine(pos.x - 1, pos.y, pos.x + 1, pos.y)
|
||||
surface.DrawLine(pos.x, pos.y - 1, pos.x, pos.y + 1)
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("HUDShouldDraw", "Disguiser.ThirdPersonHUDShouldDraw", function(name)
|
||||
|
|
|
@ -227,7 +227,6 @@ function SWEP:Undisguise()
|
|||
umsg.End()
|
||||
|
||||
// Pop!
|
||||
UndisguiseSilent()
|
||||
owner:EmitSound("Disguiser.Undisguise")
|
||||
|
||||
// We're no longer disguised
|
||||
|
|
Loading…
Reference in New Issue