2014-10-02 08:49:54 +08:00
|
|
|
CLASS.Name = "Poison Headcrab"
|
|
|
|
CLASS.TranslationName = "class_poison_headcrab"
|
|
|
|
CLASS.Description = "description_poison_headcrab"
|
|
|
|
CLASS.Help = "controls_poison_headcrab"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.BetterVersion = "Barbed Headcrab"
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
CLASS.Model = Model("models/headcrabblack.mdl")
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Wave = 3 / 6
|
2014-10-02 08:49:54 +08:00
|
|
|
CLASS.Threshold = 0.6
|
|
|
|
|
|
|
|
CLASS.SWEP = "weapon_zs_poisonheadcrab"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Health = 85
|
2014-10-02 08:49:54 +08:00
|
|
|
CLASS.Speed = 145
|
|
|
|
CLASS.JumpPower = 100
|
|
|
|
|
|
|
|
CLASS.NoFallDamage = true
|
|
|
|
CLASS.NoFallSlowdown = true
|
|
|
|
|
|
|
|
CLASS.IsHeadcrab = true
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Points = CLASS.Health/GM.HeadcrabZombiePointRatio
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
CLASS.Hull = {Vector(-12, -12, 0), Vector(12, 12, 18.1)}
|
|
|
|
CLASS.HullDuck = {Vector(-12, -12, 0), Vector(12, 12, 18.1)}
|
|
|
|
CLASS.ViewOffset = Vector(0, 0, 10)
|
|
|
|
CLASS.ViewOffsetDucked = Vector(0, 0, 10)
|
|
|
|
CLASS.StepSize = 8
|
|
|
|
CLASS.CrouchedWalkSpeed = 1
|
|
|
|
CLASS.Mass = 40
|
|
|
|
|
|
|
|
CLASS.CantDuck = true
|
|
|
|
|
|
|
|
CLASS.PainSounds = {"NPC_BlackHeadcrab.Pain"}
|
|
|
|
CLASS.DeathSounds = {"NPC_BlackHeadcrab.Die"}
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.BloodColor = BLOOD_COLOR_GREEN
|
|
|
|
|
|
|
|
local math_random = math.random
|
|
|
|
local CurTime = CurTime
|
|
|
|
local math_max = math.max
|
|
|
|
local math_sin = math.sin
|
|
|
|
local math_pi = math.pi
|
|
|
|
|
|
|
|
local ACT_RUN = ACT_RUN
|
|
|
|
local STEPSOUNDTIME_NORMAL = STEPSOUNDTIME_NORMAL
|
|
|
|
local STEPSOUNDTIME_WATER_FOOT = STEPSOUNDTIME_WATER_FOOT
|
|
|
|
local STEPSOUNDTIME_ON_LADDER = STEPSOUNDTIME_ON_LADDER
|
|
|
|
local STEPSOUNDTIME_WATER_KNEE = STEPSOUNDTIME_WATER_KNEE
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
function CLASS:Move(pl, mv)
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep.Move and wep:Move(mv) then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:ScalePlayerDamage(pl, hitgroup, dmginfo)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
local StepSounds = {
|
|
|
|
"npc/headcrab_poison/ph_step1.wav",
|
|
|
|
"npc/headcrab_poison/ph_step2.wav",
|
|
|
|
"npc/headcrab_poison/ph_step3.wav",
|
|
|
|
"npc/headcrab_poison/ph_step4.wav"
|
|
|
|
}
|
|
|
|
function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:EmitSound(StepSounds[math_random(#StepSounds)], 60)
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
--[[function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
|
|
|
|
pl:EmitSound("NPC_BlackHeadcrab.Footstep")
|
|
|
|
|
|
|
|
return true
|
|
|
|
end]]
|
|
|
|
|
|
|
|
function CLASS:PlayerStepSoundTime(pl, iType, bWalking)
|
|
|
|
if iType == STEPSOUNDTIME_NORMAL or iType == STEPSOUNDTIME_WATER_FOOT then
|
|
|
|
return 285 - pl:GetVelocity():Length()
|
|
|
|
elseif iType == STEPSOUNDTIME_ON_LADDER then
|
|
|
|
return 200
|
|
|
|
elseif iType == STEPSOUNDTIME_WATER_KNEE then
|
|
|
|
return 280
|
|
|
|
end
|
|
|
|
|
|
|
|
return 175
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:CalcMainActivity(pl, velocity)
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep:IsValid() then
|
|
|
|
if wep.ShouldPlayLeapAnimation and wep:ShouldPlayLeapAnimation() then
|
2018-05-02 06:32:59 +08:00
|
|
|
return 1, 7
|
|
|
|
end
|
|
|
|
|
|
|
|
if wep.IsGoingToSpit and wep:IsGoingToSpit() then
|
|
|
|
return 1, 2
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if pl:OnGround() then
|
2018-05-02 06:32:59 +08:00
|
|
|
if velocity:Length2DSqr() > 1 then
|
|
|
|
return ACT_RUN, -1
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
2018-05-02 06:32:59 +08:00
|
|
|
|
|
|
|
return 1, 4
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
return 1, 6
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
|
|
|
|
local seq = pl:GetSequence()
|
2018-05-02 06:32:59 +08:00
|
|
|
--[[if seq == 2 or seq == 7 then
|
2014-10-02 08:49:54 +08:00
|
|
|
pl:SetPlaybackRate(1)
|
|
|
|
|
|
|
|
if not pl.m_PrevFrameCycle then
|
|
|
|
pl.m_PrevFrameCycle = true
|
|
|
|
pl:SetCycle(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
elseif pl.m_PrevFrameCycle then
|
|
|
|
pl.m_PrevFrameCycle = nil
|
2018-05-02 06:32:59 +08:00
|
|
|
end]]
|
|
|
|
|
|
|
|
if seq == 2 then
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep:IsValid() and wep.SpitWindUp then
|
|
|
|
local spitend = wep:GetNextSpit()
|
|
|
|
local lerp = 1 - math_max(0, spitend - CurTime()) / wep.SpitWindUp
|
|
|
|
|
|
|
|
if lerp == 1 then
|
|
|
|
pl:SetCycle(0.6 + math_sin(CurTime() * math_pi) * 0.1)
|
|
|
|
else
|
|
|
|
pl:SetCycle(lerp * 0.6)
|
|
|
|
end
|
|
|
|
pl:SetPlaybackRate(0)
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
elseif seq == 7 then
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep:IsValid() and wep.PounceWindUp then
|
|
|
|
local spitend = wep:GetNextLeap()
|
|
|
|
local lerp = 1 - math_max(0, spitend - CurTime()) / wep.PounceWindUp
|
|
|
|
|
|
|
|
if lerp == 1 then
|
|
|
|
pl:SetCycle(0.7 + math_sin(CurTime() * math_pi) * 0.1)
|
|
|
|
else
|
|
|
|
pl:SetCycle(lerp * 0.7)
|
|
|
|
end
|
|
|
|
pl:SetPlaybackRate(0)
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if not CLIENT then return end
|
|
|
|
|
|
|
|
CLASS.Icon = "zombiesurvival/killicons/poisonheadcrab"
|
|
|
|
|
|
|
|
function CLASS:CreateMove(pl, cmd)
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep:IsValid() and wep.m_ViewAngles and (wep.IsLeaping and wep:IsLeaping() or wep.IsGoingToLeap and wep:IsGoingToLeap()) then
|
|
|
|
local maxdiff = FrameTime() * 15
|
|
|
|
local mindiff = -maxdiff
|
|
|
|
local originalangles = wep.m_ViewAngles
|
|
|
|
local viewangles = cmd:GetViewAngles()
|
|
|
|
|
|
|
|
local diff = math.AngleDifference(viewangles.yaw, originalangles.yaw)
|
|
|
|
if diff > maxdiff or diff < mindiff then
|
|
|
|
viewangles.yaw = math.NormalizeAngle(originalangles.yaw + math.Clamp(diff, mindiff, maxdiff))
|
|
|
|
end
|
|
|
|
|
|
|
|
wep.m_ViewAngles = viewangles
|
|
|
|
|
|
|
|
cmd:SetViewAngles(viewangles)
|
|
|
|
end
|
|
|
|
end
|