2018-05-02 06:32:59 +08:00
|
|
|
DEFINE_BASECLASS("weapon_zs_zombie")
|
|
|
|
|
|
|
|
SWEP.PrintName = "Poison Zombie"
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
SWEP.MeleeReach = 48
|
|
|
|
SWEP.MeleeDelay = 0.9
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.MeleeSize = 4.5
|
2014-10-02 08:49:54 +08:00
|
|
|
SWEP.MeleeDamage = 40
|
|
|
|
SWEP.MeleeDamageType = DMG_SLASH
|
|
|
|
SWEP.MeleeAnimationDelay = 0.35
|
|
|
|
|
|
|
|
SWEP.Primary.Delay = 1.6
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.Secondary.Delay = 4
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.PoisonThrowDelay = 1
|
|
|
|
SWEP.PoisonThrowSpeed = 380
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
SWEP.ViewModel = Model("models/weapons/v_pza.mdl")
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.WorldModel = ""
|
|
|
|
|
|
|
|
function SWEP:Think()
|
|
|
|
BaseClass.Think(self)
|
|
|
|
|
|
|
|
local time = CurTime()
|
|
|
|
|
|
|
|
if self.NextThrowAnim and time >= self.NextThrowAnim and IsFirstTimePredicted() then
|
|
|
|
self.NextThrowAnim = nil
|
|
|
|
|
|
|
|
self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.random(70, 83))
|
|
|
|
self:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
|
|
|
|
self.IdleAnimation = time + self:SequenceDuration()
|
|
|
|
end
|
|
|
|
|
|
|
|
if self.NextThrow then
|
|
|
|
if time >= self.NextThrow and IsFirstTimePredicted() then
|
|
|
|
self.NextThrow = nil
|
|
|
|
|
|
|
|
local owner = self:GetOwner()
|
|
|
|
|
|
|
|
owner.LastRangedAttack = CurTime()
|
|
|
|
|
|
|
|
owner:ResetSpeed()
|
|
|
|
owner:RawCapLegDamage(CurTime() + 1.5)
|
|
|
|
|
|
|
|
self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.random(70, 80))
|
|
|
|
|
|
|
|
if SERVER then
|
|
|
|
self:DoThrow()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
self:NextThink(time)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PrimaryAttack()
|
|
|
|
if not self.NextThrow then
|
|
|
|
BaseClass.PrimaryAttack(self)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:SecondaryAttack()
|
|
|
|
if not IsFirstTimePredicted() then return end
|
|
|
|
|
|
|
|
local time = CurTime()
|
|
|
|
if time < self:GetNextPrimaryFire() or time < self:GetNextSecondaryFire() then return end
|
|
|
|
|
|
|
|
local owner = self:GetOwner()
|
|
|
|
|
|
|
|
owner:DoAnimationEvent(ACT_RANGE_ATTACK2)
|
|
|
|
owner:SetSpeed(60)
|
|
|
|
|
|
|
|
self:EmitSound("NPC_PoisonZombie.Throw")
|
|
|
|
|
|
|
|
self:SetNextSecondaryFire(time + self.Secondary.Delay)
|
|
|
|
self:SetNextPrimaryFire(time + self.Primary.Delay)
|
|
|
|
|
|
|
|
self.NextThrow = time + self.PoisonThrowDelay
|
|
|
|
self.NextThrowAnim = self.NextThrow - 0.4
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:Reload()
|
|
|
|
if not self.NextThrow then
|
|
|
|
BaseClass.SecondaryAttack(self)
|
|
|
|
end
|
|
|
|
end
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
function SWEP:CheckMoaning()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:StopMoaningSound()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:StartMoaningSound()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayHitSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:EmitSound("npc/zombie/claw_strike"..math.random(1, 3)..".wav", 75, 80, nil, CHAN_AUTO)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayMissSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:EmitSound("npc/zombie/claw_miss"..math.random(1, 2)..".wav", 75, 80, nil, CHAN_AUTO)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayAttackSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:EmitSound("NPC_PoisonZombie.ThrowWarn")
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayAlertSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:GetOwner():EmitSound("NPC_PoisonZombie.Alert")
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
SWEP.PlayIdleSound = SWEP.PlayAlertSound
|