32 lines
856 B
Lua
32 lines
856 B
Lua
|
include("shared.lua")
|
||
|
|
||
|
CLASS.Icon = "zombiesurvival/killicons/headcrab"
|
||
|
CLASS.IconColor = Color(50, 50, 50)
|
||
|
|
||
|
function CLASS:PrePlayerDraw(pl)
|
||
|
render.SetColorModulation(0.1, 0.1, 0.1)
|
||
|
end
|
||
|
|
||
|
function CLASS:PostPlayerDraw(pl)
|
||
|
render.SetColorModulation(1, 1, 1)
|
||
|
end
|
||
|
|
||
|
function CLASS:CreateMove(pl, cmd)
|
||
|
local wep = pl:GetActiveWeapon()
|
||
|
if wep:IsValid() and wep.m_ViewAngles and wep.IsPouncing and wep:IsPouncing() then
|
||
|
local maxdiff = FrameTime() * 15
|
||
|
local mindiff = -maxdiff
|
||
|
local originalangles = wep.m_ViewAngles
|
||
|
local viewangles = cmd:GetViewAngles()
|
||
|
|
||
|
local diff = math.AngleDifference(viewangles.yaw, originalangles.yaw)
|
||
|
if diff > maxdiff or diff < mindiff then
|
||
|
viewangles.yaw = math.NormalizeAngle(originalangles.yaw + math.Clamp(diff, mindiff, maxdiff))
|
||
|
end
|
||
|
|
||
|
wep.m_ViewAngles = viewangles
|
||
|
|
||
|
cmd:SetViewAngles(viewangles)
|
||
|
end
|
||
|
end
|