2018-05-02 06:32:59 +08:00
|
|
|
INC_CLIENT()
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
include("animations.lua")
|
|
|
|
|
|
|
|
SWEP.DrawAmmo = false
|
|
|
|
SWEP.DrawCrosshair = false
|
|
|
|
SWEP.ViewModelFOV = 60
|
|
|
|
|
|
|
|
SWEP.Slot = 0
|
|
|
|
SWEP.SlotPos = 0
|
|
|
|
|
|
|
|
function SWEP:TranslateFOV(fov)
|
|
|
|
return GAMEMODE.FOVLerp * fov
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
function SWEP:DrawWeaponSelection(x, y, w, h, alpha)
|
|
|
|
self:BaseDrawWeaponSelection(x, y, w, h, alpha)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:DrawHUD()
|
2018-05-02 06:32:59 +08:00
|
|
|
if GetConVar("crosshair"):GetInt() ~= 1 then return end
|
2014-10-02 08:49:54 +08:00
|
|
|
self:DrawCrosshairDot()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:OnRemove()
|
|
|
|
self:Anim_OnRemove()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:ViewModelDrawn()
|
|
|
|
self:Anim_ViewModelDrawn()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PreDrawViewModel(vm)
|
|
|
|
if self.ShowViewModel == false then
|
|
|
|
render.SetBlend(0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PostDrawViewModel(vm)
|
|
|
|
if self.ShowViewModel == false then
|
|
|
|
render.SetBlend(1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:DrawWorldModel()
|
|
|
|
local owner = self:GetOwner()
|
2018-05-02 06:32:59 +08:00
|
|
|
if owner:IsValid() and (owner.ShadowMan or owner.SpawnProtection) then return end
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
self:Anim_DrawWorldModel()
|
|
|
|
end
|
|
|
|
|
|
|
|
local ghostlerp = 0
|
|
|
|
function SWEP:GetViewModelPosition(pos, ang)
|
2018-05-02 06:32:59 +08:00
|
|
|
local owner = self:GetOwner()
|
2014-10-02 08:49:54 +08:00
|
|
|
if self:IsSwinging() then
|
|
|
|
local rot = self.SwingRotation
|
|
|
|
local offset = self.SwingOffset
|
2018-05-02 06:32:59 +08:00
|
|
|
local armdelay = owner:GetMeleeSpeedMul()
|
|
|
|
local swingtime = self.SwingTime * (owner.MeleeSwingDelayMul or 1) * armdelay
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
ang = Angle(ang.pitch, ang.yaw, ang.roll) -- Copy
|
|
|
|
|
|
|
|
local swingend = self:GetSwingEnd()
|
2018-05-02 06:32:59 +08:00
|
|
|
local delta = swingtime - math.Clamp(swingend - CurTime(), 0, swingtime)
|
|
|
|
local power = CosineInterpolation(0, 1, delta / swingtime)
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
if power >= 0.9 then
|
|
|
|
power = (1 - power) ^ 0.4 * 2
|
|
|
|
end
|
|
|
|
|
|
|
|
pos = pos + offset.x * power * ang:Right() + offset.y * power * ang:Forward() + offset.z * power * ang:Up()
|
|
|
|
|
|
|
|
ang:RotateAroundAxis(ang:Right(), rot.pitch * power)
|
|
|
|
ang:RotateAroundAxis(ang:Up(), rot.yaw * power)
|
|
|
|
ang:RotateAroundAxis(ang:Forward(), rot.roll * power)
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if owner:GetBarricadeGhosting() then
|
2014-10-02 08:49:54 +08:00
|
|
|
ghostlerp = math.min(1, ghostlerp + FrameTime() * 4)
|
|
|
|
elseif ghostlerp > 0 then
|
|
|
|
ghostlerp = math.max(0, ghostlerp - FrameTime() * 5)
|
|
|
|
end
|
|
|
|
|
|
|
|
if ghostlerp > 0 then
|
|
|
|
pos = pos + 3.5 * ghostlerp * ang:Up()
|
|
|
|
ang:RotateAroundAxis(ang:Right(), -30 * ghostlerp)
|
|
|
|
end
|
|
|
|
|
|
|
|
return pos, ang
|
|
|
|
end
|