2014-10-02 08:49:54 +08:00
|
|
|
CLASS.Name = "The Butcher"
|
|
|
|
CLASS.TranslationName = "class_butcher"
|
|
|
|
CLASS.Description = "description_butcher"
|
|
|
|
CLASS.Help = "controls_butcher"
|
|
|
|
|
|
|
|
CLASS.Boss = true
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.KnockbackScale = 0
|
|
|
|
|
|
|
|
CLASS.Health = 1600
|
|
|
|
CLASS.Speed = 215
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
CLASS.CanTaunt = true
|
|
|
|
|
|
|
|
CLASS.FearPerInstance = 1
|
|
|
|
|
|
|
|
CLASS.Points = 30
|
|
|
|
|
|
|
|
CLASS.SWEP = "weapon_zs_butcherknifez"
|
|
|
|
|
|
|
|
CLASS.Model = Model("models/player/corpse1.mdl")
|
|
|
|
|
|
|
|
CLASS.VoicePitch = 0.65
|
|
|
|
|
|
|
|
CLASS.PainSounds = {"npc/zombie/zombie_pain1.wav", "npc/zombie/zombie_pain2.wav", "npc/zombie/zombie_pain3.wav", "npc/zombie/zombie_pain4.wav", "npc/zombie/zombie_pain5.wav", "npc/zombie/zombie_pain6.wav"}
|
|
|
|
CLASS.DeathSounds = {"npc/zombie/zombie_die1.wav", "npc/zombie/zombie_die2.wav", "npc/zombie/zombie_die3.wav"}
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
local math_random = math.random
|
|
|
|
local math_min = math.min
|
|
|
|
local CurTime = CurTime
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
local ACT_HL2MP_SWIM_MELEE = ACT_HL2MP_SWIM_MELEE
|
|
|
|
local ACT_HL2MP_IDLE_CROUCH_MELEE = ACT_HL2MP_IDLE_CROUCH_MELEE
|
|
|
|
local ACT_HL2MP_WALK_CROUCH_MELEE = ACT_HL2MP_WALK_CROUCH_MELEE
|
|
|
|
local ACT_HL2MP_IDLE_MELEE = ACT_HL2MP_IDLE_MELEE
|
|
|
|
local ACT_HL2MP_RUN_ZOMBIE = ACT_HL2MP_RUN_ZOMBIE
|
|
|
|
local ACT_HL2MP_RUN_MELEE = ACT_HL2MP_RUN_MELEE
|
|
|
|
|
|
|
|
local StepLeftSounds = {
|
|
|
|
"npc/fast_zombie/foot1.wav",
|
|
|
|
"npc/fast_zombie/foot2.wav"
|
|
|
|
}
|
|
|
|
local StepRightSounds = {
|
|
|
|
"npc/fast_zombie/foot3.wav",
|
|
|
|
"npc/fast_zombie/foot4.wav"
|
|
|
|
}
|
|
|
|
function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
|
|
|
|
if iFoot == 0 then
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:EmitSound(StepLeftSounds[math_random(#StepLeftSounds)], 70)
|
2014-10-02 08:49:54 +08:00
|
|
|
else
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:EmitSound(StepRightSounds[math_random(#StepRightSounds)], 70)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:CalcMainActivity(pl, velocity)
|
|
|
|
if pl:WaterLevel() >= 3 then
|
2018-05-02 06:32:59 +08:00
|
|
|
return ACT_HL2MP_SWIM_MELEE, -1
|
|
|
|
end
|
|
|
|
|
|
|
|
if pl:Crouching() then
|
|
|
|
if velocity:Length2DSqr() <= 1 then
|
|
|
|
return ACT_HL2MP_IDLE_CROUCH_MELEE, -1
|
|
|
|
end
|
|
|
|
|
|
|
|
return ACT_HL2MP_WALK_CROUCH_MELEE, -1
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
local swinging = false
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep:IsValid() and CurTime() < wep:GetNextPrimaryFire() then
|
|
|
|
swinging = true
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if velocity:Length2DSqr() <= 1 then
|
2014-10-02 08:49:54 +08:00
|
|
|
if swinging then
|
2018-05-02 06:32:59 +08:00
|
|
|
return ACT_HL2MP_IDLE_MELEE, -1
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
2018-05-02 06:32:59 +08:00
|
|
|
|
|
|
|
return ACT_HL2MP_RUN_ZOMBIE, -1
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if swinging then
|
|
|
|
return ACT_HL2MP_RUN_MELEE, -1
|
|
|
|
end
|
|
|
|
|
|
|
|
return ACT_HL2MP_RUN_ZOMBIE, -1
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
|
|
|
|
local len2d = velocity:Length2D()
|
|
|
|
if len2d > 0.5 then
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:SetPlaybackRate(math_min(len2d / maxseqgroundspeed, 3))
|
2014-10-02 08:49:54 +08:00
|
|
|
else
|
|
|
|
pl:SetPlaybackRate(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:DoAnimationEvent(pl, event, data)
|
|
|
|
if event == PLAYERANIMEVENT_ATTACK_PRIMARY then
|
|
|
|
pl:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE, true)
|
|
|
|
return ACT_INVALID
|
2018-05-02 06:32:59 +08:00
|
|
|
elseif event == PLAYERANIMEVENT_RELOAD then
|
|
|
|
pl:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_TAUNT_ZOMBIE, true)
|
|
|
|
return ACT_INVALID
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if SERVER then
|
|
|
|
function CLASS:OnSpawned(pl)
|
|
|
|
pl:CreateAmbience("butcherambience")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if not CLIENT then return end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Icon = "zombiesurvival/killicons/butcher"
|
|
|
|
|
|
|
|
local render_SetMaterial = render.SetMaterial
|
|
|
|
local render_DrawSprite = render.DrawSprite
|
|
|
|
local angle_zero = angle_zero
|
|
|
|
local LocalToWorld = LocalToWorld
|
|
|
|
|
|
|
|
local colGlow = Color(235, 50, 0)
|
|
|
|
local matGlow = Material("sprites/glow04_noz")
|
|
|
|
local vecEyeLeft = Vector(4, -4.6, -1)
|
|
|
|
local vecEyeRight = Vector(4, -4.6, 1)
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
function CLASS:PrePlayerDraw(pl)
|
|
|
|
render.SetColorModulation(1, 0.5, 0.5)
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:PostPlayerDraw(pl)
|
|
|
|
render.SetColorModulation(1, 1, 1)
|
2018-05-02 06:32:59 +08:00
|
|
|
|
|
|
|
if pl == MySelf and not pl:ShouldDrawLocalPlayer() or pl.SpawnProtection then return end
|
|
|
|
|
|
|
|
local pos, ang = pl:GetBonePositionMatrixed(6)
|
|
|
|
if pos then
|
|
|
|
render_SetMaterial(matGlow)
|
|
|
|
render_DrawSprite(LocalToWorld(vecEyeLeft, angle_zero, pos, ang), 4, 4, colGlow)
|
|
|
|
render_DrawSprite(LocalToWorld(vecEyeRight, angle_zero, pos, ang), 4, 4, colGlow)
|
|
|
|
end
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|