2014-10-02 08:49:54 +08:00
|
|
|
SWEP.Base = "weapon_zs_zombie"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.PrintName = "Wraith"
|
|
|
|
|
|
|
|
SWEP.MeleeDelay = 0.8
|
2014-10-02 08:49:54 +08:00
|
|
|
SWEP.MeleeReach = 48
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.MeleeSize = 4.5
|
|
|
|
SWEP.MeleeDamage = 43
|
2014-10-02 08:49:54 +08:00
|
|
|
SWEP.MeleeDamageType = DMG_SLASH
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.MeleeAnimationDelay = 0.25
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
SWEP.AlertDelay = 6
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
SWEP.Primary.Delay = 1.8
|
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 = ""
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
function SWEP:StopMoaningSound()
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:StartMoaningSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:GetOwner():EmitSound("zombiesurvival/wraithdeath"..math.random(4)..".ogg")
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:PlayHitSound()
|
2018-05-02 06:32:59 +08:00
|
|
|
self:EmitSound("ambient/machines/slicer"..math.random(4)..".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(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/antlion/distract1.wav")
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function viewpunch(ent, power)
|
|
|
|
if ent:IsValid() and ent:Alive() then
|
|
|
|
ent:ViewPunch(Angle(math.Rand(0.75, 1) * (math.random(0, 1) == 0 and 1 or -1), math.Rand(0.75, 1) * (math.random(0, 1) == 0 and 1 or -1), math.Rand(0.75, 1) * (math.random(0, 1) == 0 and 1 or -1)) * power)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function SWEP:DoAlert()
|
2018-05-02 06:32:59 +08:00
|
|
|
local owner = self:GetOwner()
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
owner:EmitSound("npc/stalker/go_alert2a.wav", 90)
|
2014-10-02 08:49:54 +08:00
|
|
|
owner:ViewPunch(Angle(-20, 0, math.Rand(-10, 10)))
|
2018-05-02 06:32:59 +08:00
|
|
|
owner:DoReloadEvent()
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
owner:LagCompensation(true)
|
|
|
|
|
|
|
|
local mouthpos = owner:EyePos() + owner:GetUp() * -3
|
|
|
|
local screampos = mouthpos + owner:GetAimVector() * 16
|
|
|
|
for _, ent in pairs(ents.FindInSphere(screampos, 92)) do
|
2018-05-02 06:32:59 +08:00
|
|
|
if ent and ent:IsValidHuman() then
|
2014-10-02 08:49:54 +08:00
|
|
|
local entearpos = ent:EyePos()
|
|
|
|
local dist = screampos:Distance(entearpos)
|
|
|
|
if dist <= 92 and TrueVisible(entearpos, screampos) then
|
|
|
|
local power = (92 / dist - 1) * 2
|
|
|
|
viewpunch(ent, power)
|
|
|
|
for i=1, 5 do
|
|
|
|
timer.Simple(0.15 * i, function() viewpunch(ent, power - i * 0.125) end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
owner:LagCompensation(false)
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
util.PrecacheSound("npc/antlion/distract1.wav")
|
|
|
|
util.PrecacheSound("ambient/machines/slicer1.wav")
|
|
|
|
util.PrecacheSound("ambient/machines/slicer2.wav")
|
|
|
|
util.PrecacheSound("ambient/machines/slicer3.wav")
|
|
|
|
util.PrecacheSound("ambient/machines/slicer4.wav")
|
|
|
|
util.PrecacheSound("npc/zombie/claw_miss1.wav")
|
|
|
|
util.PrecacheSound("npc/zombie/claw_miss2.wav")
|