zombiesurvival-evolved/gamemodes/zombiesurvival/gamemode/zombieclasses/bloated_zombie/shared.lua

133 lines
3.3 KiB
Lua
Raw Permalink Normal View History

CLASS.Name = "Bloated Zombie"
CLASS.TranslationName = "class_bloated_zombie"
CLASS.Description = "description_bloated_zombie"
CLASS.Help = "controls_bloated_zombie"
CLASS.BetterVersion = "Vile Bloated Zombie"
CLASS.Wave = 2 / 6
CLASS.Health = 325
CLASS.Speed = 125
--CLASS.JumpPower = DEFAULT_JUMP_POWER * 0.811
CLASS.Mass = DEFAULT_MASS * 2
CLASS.CanTaunt = true
CLASS.Points = CLASS.Health/GM.HumanoidZombiePointRatio
CLASS.SWEP = "weapon_zs_bloatedzombie"
CLASS.Model = Model("models/player/fatty/fatty.mdl")
CLASS.DeathSounds = {"npc/ichthyosaur/water_growl5.wav"}
CLASS.VoicePitch = 0.6
CLASS.CanFeignDeath = true
CLASS.BloodColor = BLOOD_COLOR_GREEN
local math_random = math.random
local math_Rand = math.Rand
local math_min = math.min
local math_max = math.max
local math_ceil = math.ceil
local string_format = string.format
local CurTime = CurTime
local DIR_BACK = DIR_BACK
local ACT_HL2MP_ZOMBIE_SLUMP_RISE = ACT_HL2MP_ZOMBIE_SLUMP_RISE
local ACT_HL2MP_SWIM_PISTOL = ACT_HL2MP_SWIM_PISTOL
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 = ACT_HL2MP_RUN_ZOMBIE
function CLASS:PlayPainSound(pl)
pl:EmitSound(string_format("npc/zombie_poison/pz_idle%d.wav", math_random(2, 3)), 72, math_Rand(75, 85))
pl.NextPainSound = CurTime() + 0.5
return true
end
local StepSounds = {
"npc/zombie/foot1.wav",
"npc/zombie/foot2.wav",
"npc/zombie/foot3.wav"
}
local ScuffSounds = {
"npc/zombie/foot_slide1.wav",
"npc/zombie/foot_slide2.wav",
"npc/zombie/foot_slide3.wav"
}
function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
if math_random() < 0.15 then
pl:EmitSound(ScuffSounds[math_random(#ScuffSounds)], 70, 75)
else
pl:EmitSound(StepSounds[math_random(#StepSounds)], 70, 75)
end
return true
end
function CLASS:CalcMainActivity(pl, velocity)
local feign = pl.FeignDeath
if feign and feign:IsValid() then
if feign:GetDirection() == DIR_BACK then
return 1, pl:LookupSequence("zombie_slump_rise_02_fast")
end
return ACT_HL2MP_ZOMBIE_SLUMP_RISE, -1
end
if pl:WaterLevel() >= 3 then
return ACT_HL2MP_SWIM_PISTOL, -1
end
if pl:Crouching() and pl:OnGround() then
if velocity:Length2DSqr() <= 1 then
return ACT_HL2MP_IDLE_CROUCH_ZOMBIE, -1
end
return ACT_HL2MP_WALK_CROUCH_ZOMBIE_01 - 1 + math_ceil((CurTime() / 4 + pl:EntIndex()) % 3), -1
end
return ACT_HL2MP_RUN_ZOMBIE, -1
end
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
local feign = pl.FeignDeath
if feign and feign:IsValid() then
if feign:GetState() == 1 then
pl:SetCycle(1 - math_max(feign:GetStateEndTime() - CurTime(), 0) * 0.666)
else
pl:SetCycle(math_max(feign:GetStateEndTime() - CurTime(), 0) * 0.666)
end
pl:SetPlaybackRate(0)
return true
end
local len2d = velocity:Length2D()
if len2d > 1 then
pl:SetPlaybackRate(math_min(len2d / maxseqgroundspeed, 3))
else
pl:SetPlaybackRate(1)
end
return true
end
function CLASS:DoAnimationEvent(pl, event, data)
if event == PLAYERANIMEVENT_ATTACK_PRIMARY then
pl:DoZombieAttackAnim(data)
return ACT_INVALID
elseif event == PLAYERANIMEVENT_RELOAD then
pl:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_TAUNT_ZOMBIE, true)
return ACT_INVALID
end
end
function CLASS:DoesntGiveFear(pl)
return pl.FeignDeath and pl.FeignDeath:IsValid()
end