2014-10-02 08:49:54 +08:00
|
|
|
AddCSLuaFile()
|
|
|
|
|
|
|
|
SWEP.Base = "weapon_zs_zombie"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.PrintName = "Gore Child"
|
|
|
|
|
|
|
|
SWEP.ViewModel = "models/weapons/c_arms_citizen.mdl"
|
|
|
|
SWEP.WorldModel = ""
|
|
|
|
SWEP.UseHands = true
|
|
|
|
SWEP.ViewModelFOV = 40
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
SWEP.MeleeDelay = 0
|
|
|
|
SWEP.MeleeReach = 16
|
|
|
|
SWEP.MeleeDamage = 3
|
|
|
|
SWEP.MeleeForceScale = 0.025
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.MeleeSize = 1 --0.5
|
2014-10-02 08:49:54 +08:00
|
|
|
SWEP.MeleeDamageType = DMG_SLASH
|
|
|
|
SWEP.Primary.Delay = 0.32
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
function SWEP:MeleeHit(ent, trace, damage, forcescale)
|
|
|
|
if ent:IsPlayer() then
|
|
|
|
local owner = self:GetOwner()
|
|
|
|
|
|
|
|
if owner.Master and owner.Master:IsValidLivingZombie() then
|
|
|
|
owner.Master:AddLifeHumanDamage(damage)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
self.BaseClass.MeleeHit(self, ent, trace, damage, forcescale)
|
|
|
|
end
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
function SWEP:Think()
|
|
|
|
self.BaseClass.Think(self)
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if IsFirstTimePredicted() then
|
|
|
|
local curtime = CurTime()
|
|
|
|
local owner = self:GetOwner()
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if self:GetSwinging() then
|
|
|
|
if not owner:KeyDown(IN_ATTACK) and self.SwingStop and self.SwingStop <= curtime then
|
|
|
|
self:SetSwinging(false)
|
|
|
|
self.SwingStop = nil
|
|
|
|
end
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
self:NextThink(CurTime())
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:Swung()
|
2018-05-02 06:32:59 +08:00
|
|
|
if not IsFirstTimePredicted() then return end
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
self.SwingStop = CurTime() + 0.5
|
|
|
|
|
|
|
|
if not self:GetSwinging() then
|
|
|
|
self:SetSwinging(true)
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
self.AltSwing = not self.AltSwing
|
|
|
|
|
|
|
|
local vm = self:GetOwner():GetViewModel()
|
|
|
|
vm:SendViewModelMatchingSequence(vm:LookupSequence(self.AltSwing and "fists_left" or "fists_right"))
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
self.BaseClass.Swung(self)
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
function SWEP:Deploy()
|
|
|
|
local vm = self:GetOwner():GetViewModel()
|
|
|
|
vm:SendViewModelMatchingSequence(vm:LookupSequence("fists_draw"))
|
|
|
|
|
|
|
|
return self.BaseClass.Deploy(self)
|
|
|
|
end
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
function SWEP:Reload()
|
|
|
|
self:SecondaryAttack()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:IsMoaning()
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayAlertSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:GetOwner():EmitSound("ambient/creatures/teddy.wav", 65, 85)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayIdleSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:GetOwner():EmitSound("ambient/creatures/teddy.wav", 65)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayAttackSound()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayHitSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:EmitSound("physics/body/body_medium_impact_hard"..math.random(6)..".wav", 65, math.random(130, 140), 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(2)..".wav", 65, math.random(140, 150), nil, CHAN_AUTO)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:SetSwinging(swinging)
|
|
|
|
self:SetDTBool(2, swinging)
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:GetSwinging()
|
|
|
|
return self:GetDTBool(2)
|
|
|
|
end
|