zombiesurvival-evolved/gamemodes/zombiesurvival/entities/weapons/weapon_zs_basefood/cl_init.lua
William Moodhe e9da54c2f9 ZS updates for 2014-2018
Too many changes to list.
2018-05-01 18:32:59 -04:00

31 lines
878 B
Lua

INC_CLIENT()
SWEP.ViewModelFOV = 60
SWEP.ViewModelFlip = false
SWEP.ShowViewModel = false
SWEP.ShowWorldModel = false
function SWEP:CalcViewModelView(vm, oldpos, oldang, pos, ang)
local eattime = self:GetEatEndTime()
if eattime == 0 then return end
local delta = math.Clamp((CurTime() - self:GetEatStartTime()) / self:GetFoodEatTime(), 0, 1)
if delta > 0 then
local lerp = math.sin(6 * math.pi * delta)
lerp = math.abs(lerp)
local Offset = self.EatViewOffset
if self.EatViewAngles then
ang = Angle(ang.p, ang.y, ang.r)
ang:RotateAroundAxis(ang:Right(), self.EatViewAngles.x * lerp)
ang:RotateAroundAxis(ang:Up(), self.EatViewAngles.y * lerp)
ang:RotateAroundAxis(ang:Forward(), self.EatViewAngles.z * lerp)
end
pos = pos + Offset.x * lerp * ang:Right() + Offset.y * lerp * ang:Forward() + Offset.z * lerp * ang:Up()
end
return pos, ang
end