zombiesurvival-evolved/gamemodes/zombiesurvival/entities/weapons/weapon_zs_graveshovel/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
1,004 B
Lua

INC_SERVER()
SWEP.OriginalMeleeDamage = SWEP.MeleeDamage
function SWEP:Deploy()
self:SetShovelCharge(self:GetOwner().GraveShovelDamage or 0)
return self.BaseClass.Deploy(self)
end
function SWEP:OnMeleeHit(hitent, hitflesh, tr)
if self:GetOwner().GraveShovelDamage then
self.MeleeDamage = self.MeleeDamage + self:GetOwner().GraveShovelDamage
end
end
function SWEP:PostOnMeleeHit(hitent, hitflesh, tr)
if hitent:IsValid() and hitent:IsPlayer() and hitent.Revive and hitent.Revive:IsValid() and gamemode.Call("PlayerShouldTakeDamage", hitent, self:GetOwner()) then
local killer = self:GetOwner()
if killer:IsValid() then
killer.GraveShovelDamage = killer.GraveShovelDamage and killer.GraveShovelDamage + 5 or 5
killer:EmitSound("hl1/ambience/particle_suck1.wav", 65, 250, 0.65)
end
self:SetShovelCharge(killer.GraveShovelDamage or 0)
hitent:TakeSpecialDamage(hitent:Health(), DMG_DIRECT, self:GetOwner(), self, tr.HitPos)
end
self.MeleeDamage = self.OriginalMeleeDamage
end