2014-10-02 08:49:54 +08:00
|
|
|
AddCSLuaFile()
|
|
|
|
|
|
|
|
SWEP.Base = "weapon_zs_zombie"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.ChargeTime = 2.1
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
function SWEP:PrimaryAttack()
|
|
|
|
if self:GetChargeStart() == 0 then
|
|
|
|
self:SetChargeStart(CurTime())
|
2018-05-02 06:32:59 +08:00
|
|
|
|
|
|
|
self.m_ViewAngles = self:GetOwner():EyeAngles()
|
|
|
|
|
|
|
|
if IsFirstTimePredicted() then
|
|
|
|
self:EmitSound(")ambient/levels/labs/teleport_mechanism_windup5.wav", 80, 185, 0.75)
|
|
|
|
end
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:SecondaryAttack()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:Reload()
|
|
|
|
self.BaseClass.SecondaryAttack(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:Think()
|
|
|
|
if self:GetCharge() >= 1 then
|
2018-05-02 06:32:59 +08:00
|
|
|
self:GetOwner():Kill()
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
self:NextThink(CurTime())
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:IsMoaning()
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:Move(mv)
|
|
|
|
local charge = self:GetCharge()
|
|
|
|
if charge > 0 then
|
2018-05-02 06:32:59 +08:00
|
|
|
local mul = 1 + charge * 0.7
|
|
|
|
mv:SetMaxSpeed(mv:GetMaxSpeed() * mul)
|
|
|
|
mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * mul)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:SetChargeStart(time)
|
|
|
|
self:SetDTFloat(0, time)
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:GetChargeStart()
|
|
|
|
return self:GetDTFloat(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:GetCharge()
|
|
|
|
if self:GetChargeStart() == 0 then return 0 end
|
|
|
|
|
|
|
|
return math.Clamp((CurTime() - self:GetChargeStart()) / self.ChargeTime, 0, 1)
|
|
|
|
end
|