2014-10-02 08:49:54 +08:00
|
|
|
AddCSLuaFile()
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.PrintName = "Ghoul"
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
SWEP.Base = "weapon_zs_zombie"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.MeleeDamage = 23
|
2014-11-07 13:03:40 +08:00
|
|
|
SWEP.MeleeForceScale = 0.5
|
|
|
|
SWEP.SlowDownScale = 0.25
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.EnfeebleDurationMul = 10 / SWEP.MeleeDamage
|
2014-11-07 13:03:40 +08:00
|
|
|
--[[SWEP.MeleeForceScale = 0.1
|
2014-10-02 08:49:54 +08:00
|
|
|
SWEP.SlowDownScale = 2.25
|
2014-11-07 13:03:40 +08:00
|
|
|
SWEP.SlowDownImmunityTime = 2]]
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
function SWEP:ApplyMeleeDamage(ent, trace, damage)
|
2018-05-02 06:32:59 +08:00
|
|
|
ent:PoisonDamage(damage, self:GetOwner(), self, trace.HitPos)
|
2014-11-07 13:03:40 +08:00
|
|
|
if SERVER and ent:IsPlayer() then
|
2018-05-02 06:32:59 +08:00
|
|
|
local gt = ent:GiveStatus("enfeeble", damage * self.EnfeebleDurationMul)
|
|
|
|
if gt and gt:IsValid() then
|
|
|
|
gt.Applier = self:GetOwner()
|
|
|
|
end
|
2014-11-07 13:03:40 +08:00
|
|
|
end
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:Reload()
|
|
|
|
self.BaseClass.SecondaryAttack(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayAlertSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:GetOwner():EmitSound("npc/fast_zombie/fz_alert_close1.wav", 75, math.Rand(70, 80))
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
SWEP.PlayIdleSound = SWEP.PlayAlertSound
|
|
|
|
|
|
|
|
function SWEP:PlayAttackSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130))
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
local Spread = {
|
|
|
|
{0, 0},
|
|
|
|
{-1, 0},
|
|
|
|
{1, 0},
|
|
|
|
{-0.5, 0},
|
|
|
|
{0.5, 0}
|
|
|
|
}
|
2014-10-02 08:49:54 +08:00
|
|
|
local function DoFleshThrow(pl, wep)
|
|
|
|
if pl:IsValid() and pl:Alive() and wep:IsValid() then
|
|
|
|
pl:ResetSpeed()
|
2018-05-02 06:32:59 +08:00
|
|
|
pl.LastRangedAttack = CurTime()
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
if SERVER then
|
|
|
|
local startpos = pl:GetShootPos()
|
|
|
|
local aimang = pl:EyeAngles()
|
2018-05-02 06:32:59 +08:00
|
|
|
local ang
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
for _, spr in pairs(Spread) do
|
|
|
|
ang = Angle(aimang.p, aimang.y, aimang.r)
|
|
|
|
ang:RotateAroundAxis(ang:Up(), spr[1] * 5)
|
|
|
|
ang:RotateAroundAxis(ang:Right(), spr[2] * 5)
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
local ent = ents.Create("projectile_ghoulflesh")
|
2014-10-02 08:49:54 +08:00
|
|
|
if ent:IsValid() then
|
|
|
|
ent:SetPos(startpos)
|
|
|
|
ent:SetOwner(pl)
|
|
|
|
ent:Spawn()
|
2014-12-08 04:02:40 +08:00
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
local phys = ent:GetPhysicsObject()
|
|
|
|
if phys:IsValid() then
|
2018-05-02 06:32:59 +08:00
|
|
|
phys:SetVelocityInstantaneous(ang:Forward() * 660)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95))
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:SecondaryAttack()
|
2018-05-02 06:32:59 +08:00
|
|
|
local owner = self:GetOwner()
|
2014-10-02 08:49:54 +08:00
|
|
|
if CurTime() < self:GetNextPrimaryFire() or CurTime() < self:GetNextSecondaryFire() or IsValid(owner.FeignDeath) then return end
|
|
|
|
|
|
|
|
self:SetNextSecondaryFire(CurTime() + 3)
|
|
|
|
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
self:GetOwner():DoZombieEvent()
|
2014-10-02 08:49:54 +08:00
|
|
|
self:EmitSound("npc/fast_zombie/leap1.wav", 74, math.Rand(110, 130))
|
2018-05-02 06:32:59 +08:00
|
|
|
self:EmitSound(string.format("physics/body/body_medium_break%d.wav", math.random(2, 4)), 72, math.Rand(85, 95))
|
|
|
|
--self:GetOwner():RawCapLegDamage(CurTime() + 3)
|
2014-10-02 08:49:54 +08:00
|
|
|
self:SendWeaponAnim(ACT_VM_HITCENTER)
|
|
|
|
self.IdleAnimation = CurTime() + self:SequenceDuration()
|
|
|
|
|
|
|
|
timer.Simple(0.7, function() DoFleshThrow(owner, self) end)
|
|
|
|
end
|
|
|
|
|
|
|
|
if not CLIENT then return end
|
|
|
|
|
|
|
|
function SWEP:ViewModelDrawn()
|
|
|
|
render.ModelMaterialOverride(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
local matSheet = Material("models/weapons/v_zombiearms/ghoulsheet")
|
|
|
|
function SWEP:PreDrawViewModel(vm)
|
|
|
|
render.ModelMaterialOverride(matSheet)
|
|
|
|
end
|