164 lines
4.4 KiB
Lua
164 lines
4.4 KiB
Lua
|
CLASS.Base = "fast_zombie"
|
||
|
CLASS.Revives = false
|
||
|
|
||
|
CLASS.Name = "Lacerator"
|
||
|
CLASS.TranslationName = "class_lacerator"
|
||
|
CLASS.Description = "description_lacerator"
|
||
|
CLASS.Help = "controls_lacerator"
|
||
|
|
||
|
CLASS.Model = Model("models/player/zombie_lacerator2.mdl")
|
||
|
|
||
|
CLASS.Wave = 4 / 6
|
||
|
|
||
|
CLASS.Health = 225
|
||
|
CLASS.Speed = 270
|
||
|
CLASS.SWEP = "weapon_zs_lacerator"
|
||
|
|
||
|
CLASS.Hull = {Vector(-16, -16, 0), Vector(16, 16, 58)}
|
||
|
CLASS.HullDuck = {Vector(-16, -16, 0), Vector(16, 16, 32)}
|
||
|
CLASS.ViewOffset = Vector(0, 0, 50)
|
||
|
CLASS.ViewOffsetDucked = Vector(0, 0, 24)
|
||
|
|
||
|
CLASS.Points = CLASS.Health/GM.NoHeadboxZombiePointRatio
|
||
|
|
||
|
CLASS.CanTaunt = true
|
||
|
|
||
|
CLASS.VoicePitch = 0.75
|
||
|
|
||
|
CLASS.NoFallDamage = true
|
||
|
CLASS.NoFallSlowdown = true
|
||
|
|
||
|
local math_random = math.random
|
||
|
local math_min = math.min
|
||
|
local math_Clamp = math.Clamp
|
||
|
local math_ceil = math.ceil
|
||
|
local CurTime = CurTime
|
||
|
local BoneScale = Vector(2,2,2)
|
||
|
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
|
||
|
local ACT_ZOMBIE_LEAP_START = ACT_ZOMBIE_LEAP_START
|
||
|
local ACT_ZOMBIE_LEAPING = ACT_ZOMBIE_LEAPING
|
||
|
local ACT_HL2MP_IDLE_CROUCH_ZOMBIE = ACT_HL2MP_IDLE_CROUCH_ZOMBIE
|
||
|
local ACT_HL2MP_WALK_CROUCH_ZOMBIE_01 = ACT_HL2MP_WALK_CROUCH_ZOMBIE_01
|
||
|
local ACT_HL2MP_RUN_ZOMBIE_FAST = ACT_HL2MP_RUN_ZOMBIE_FAST
|
||
|
local ACT_GMOD_GESTURE_TAUNT_ZOMBIE = ACT_GMOD_GESTURE_TAUNT_ZOMBIE
|
||
|
local ACT_GMOD_GESTURE_RANGE_ZOMBIE_SPECIAL = ACT_GMOD_GESTURE_RANGE_ZOMBIE_SPECIAL
|
||
|
local ACT_INVALID = ACT_INVALID
|
||
|
|
||
|
local GearFoley = {
|
||
|
"npc/combine_soldier/gear1.wav",
|
||
|
"npc/combine_soldier/gear2.wav",
|
||
|
"npc/combine_soldier/gear3.wav",
|
||
|
"npc/combine_soldier/gear4.wav",
|
||
|
"npc/combine_soldier/gear5.wav",
|
||
|
"npc/combine_soldier/gear6.wav"
|
||
|
}
|
||
|
function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
|
||
|
if iFoot == 0 then
|
||
|
pl:EmitSound("npc/antlion_guard/foot_heavy1.wav", 70, math_random(120,133), 0.4)
|
||
|
else
|
||
|
pl:EmitSound("npc/antlion_guard/foot_heavy2.wav", 70, math_random(120,133), 0.4)
|
||
|
end
|
||
|
pl:EmitSound(GearFoley[math_random(#GearFoley)], 70, 100, 0.6)
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function CLASS:PlayerStepSoundTime(pl, iType, bWalking)
|
||
|
if iType == STEPSOUNDTIME_NORMAL or iType == STEPSOUNDTIME_WATER_FOOT then
|
||
|
return 580 - pl:GetVelocity():Length()
|
||
|
elseif iType == STEPSOUNDTIME_ON_LADDER then
|
||
|
return 400
|
||
|
elseif iType == STEPSOUNDTIME_WATER_KNEE then
|
||
|
return 550
|
||
|
end
|
||
|
|
||
|
return 250
|
||
|
end
|
||
|
|
||
|
function CLASS:PlayPainSound(pl)
|
||
|
pl:EmitSound("npc/fast_zombie/leap1.wav", 75, math_random(70, 80))
|
||
|
|
||
|
pl.NextPainSound = CurTime() + .5
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function CLASS:PlayDeathSound(pl)
|
||
|
pl:EmitSound("npc/zombie/zombie_die"..math_random(3)..".wav",70, math_random(80,85))
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
|
||
|
local wep = pl:GetActiveWeapon()
|
||
|
if not wep:IsValid() or not wep.GetClimbing or not wep.GetPounceTime then return end
|
||
|
|
||
|
local len2d = velocity:Length2D()
|
||
|
if len2d > 1 then
|
||
|
pl:SetPlaybackRate(math_min(len2d / maxseqgroundspeed * 0.666, 3))
|
||
|
else
|
||
|
pl:SetPlaybackRate(1)
|
||
|
end
|
||
|
|
||
|
if wep.GetSwinging and wep:GetSwinging() then
|
||
|
if not pl.PlayingFZSwing then
|
||
|
pl.PlayingFZSwing = true
|
||
|
pl:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_RANGE_FRENZY)
|
||
|
end
|
||
|
elseif pl.PlayingFZSwing then
|
||
|
pl.PlayingFZSwing = false
|
||
|
pl:AnimResetGestureSlot(GESTURE_SLOT_ATTACK_AND_RELOAD) --pl:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_RANGE_FRENZY, true)
|
||
|
end
|
||
|
|
||
|
if wep:GetClimbing() then
|
||
|
local vel = pl:GetVelocity()
|
||
|
local speed = vel:LengthSqr()
|
||
|
if speed > 64 then --8^2
|
||
|
pl:SetPlaybackRate(math_Clamp(speed / 25600, 0, 1) * (vel.z < 0 and -1 or 1)) --160^2
|
||
|
else
|
||
|
pl:SetPlaybackRate(0)
|
||
|
end
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
if wep.GetPounceTime and wep:GetPounceTime() > 0 then
|
||
|
pl:SetPlaybackRate(0.25)
|
||
|
|
||
|
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
|
||
|
end
|
||
|
|
||
|
if not pl:OnGround() or pl:WaterLevel() >= 3 then
|
||
|
pl:SetPlaybackRate(1)
|
||
|
|
||
|
if pl:GetCycle() >= 1 then
|
||
|
pl:SetCycle(pl:GetCycle() - 1)
|
||
|
end
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
if wep:IsRoaring() and velocity:Length2DSqr() <= 1 then
|
||
|
pl:SetPlaybackRate(0)
|
||
|
pl:SetCycle(math_Clamp(1 - (wep:GetRoarEndTime() - CurTime()) / wep.RoarTime, 0, 1) * 0.9)
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
if SERVER then return end
|
||
|
|
||
|
CLASS.Icon = "zombiesurvival/killicons/lacerator"
|