2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Icon = "zombiesurvival/killicons/gigagorechild"
|
2014-10-02 08:49:54 +08:00
|
|
|
CLASS.Name = "Gore Child"
|
|
|
|
CLASS.TranslationName = "class_gore_child"
|
|
|
|
CLASS.Description = "description_gore_child"
|
|
|
|
CLASS.Help = "controls_gore_child"
|
|
|
|
|
|
|
|
CLASS.Wave = 0
|
|
|
|
CLASS.Unlocked = true
|
|
|
|
CLASS.Hidden = true
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Health = 20
|
|
|
|
CLASS.Speed = 150
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
CLASS.Points = 0.5
|
|
|
|
|
|
|
|
CLASS.CanTaunt = true
|
|
|
|
|
|
|
|
CLASS.SWEP = "weapon_zs_gorechild"
|
|
|
|
|
|
|
|
CLASS.Model = Model("models/vinrax/player/doll_player.mdl")
|
|
|
|
|
|
|
|
CLASS.VoicePitch = 1.5
|
|
|
|
|
|
|
|
CLASS.ModelScale = 0.4
|
|
|
|
|
|
|
|
CLASS.Mass = 30
|
|
|
|
CLASS.ViewOffset = DEFAULT_VIEW_OFFSET * CLASS.ModelScale
|
|
|
|
CLASS.ViewOffsetDucked = DEFAULT_VIEW_OFFSET_DUCKED * CLASS.ModelScale
|
|
|
|
CLASS.StepSize = 8
|
|
|
|
CLASS.Hull = {Vector(-16, -16, 0) * CLASS.ModelScale, Vector(16, 16, 100) * CLASS.ModelScale}
|
|
|
|
CLASS.HullDuck = {Vector(-16, -16, 0) * CLASS.ModelScale, Vector(16, 16, 60) * CLASS.ModelScale}
|
|
|
|
|
|
|
|
CLASS.CanFeignDeath = true
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
local CurTime = CurTime
|
|
|
|
local math_random = math.random
|
|
|
|
local math_max = math.max
|
|
|
|
local math_min = math.min
|
|
|
|
local math_ceil = math.ceil
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
local StepLeftSounds = {
|
|
|
|
"npc/zombie/foot1.wav",
|
|
|
|
"npc/zombie/foot2.wav"
|
|
|
|
}
|
|
|
|
local StepRightSounds = {
|
|
|
|
"npc/zombie/foot2.wav",
|
|
|
|
"npc/zombie/foot3.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)], 55, 150)
|
2014-10-02 08:49:54 +08:00
|
|
|
else
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:EmitSound(StepRightSounds[math_random(#StepRightSounds)], 55, 150)
|
2014-10-02 08:49:54 +08:00
|
|
|
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
|
2018-05-02 06:32:59 +08:00
|
|
|
return 1, pl:LookupSequence("zombie_slump_rise_02_fast")
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
2018-05-02 06:32:59 +08:00
|
|
|
|
|
|
|
return ACT_HL2MP_ZOMBIE_SLUMP_RISE, -1
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
if pl:WaterLevel() >= 3 then
|
2018-05-02 06:32:59 +08:00
|
|
|
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
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
2018-05-02 06:32:59 +08:00
|
|
|
|
|
|
|
return ACT_HL2MP_WALK_CROUCH_ZOMBIE_01 - 1 + math_ceil((CurTime() / 4 + pl:EntIndex()) % 3), -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
|
|
|
|
|
|
|
|
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if not wep:IsValid() or not wep.GetSwinging then return end
|
|
|
|
|
|
|
|
if 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)
|
|
|
|
end
|
|
|
|
|
|
|
|
local feign = pl.FeignDeath
|
|
|
|
if feign and feign:IsValid() then
|
|
|
|
if feign:GetState() == 1 then
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:SetCycle(1 - math_max(feign:GetStateEndTime() - CurTime(), 0) * 0.666)
|
2014-10-02 08:49:54 +08:00
|
|
|
else
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:SetCycle(math_max(feign:GetStateEndTime() - CurTime(), 0) * 0.666)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
pl:SetPlaybackRate(0)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
local len2d = velocity:Length2D()
|
2018-05-02 06:32:59 +08:00
|
|
|
if len2d > 1 then
|
|
|
|
pl:SetPlaybackRate(math_min(len2d / maxseqgroundspeed, 3))
|
2014-10-02 08:49:54 +08:00
|
|
|
else
|
|
|
|
pl:SetPlaybackRate(1)
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if len2d >= 16 then
|
|
|
|
pl:SetPlaybackRate(pl:GetPlaybackRate() * 2)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:PlayerStepSoundTime(pl, iType, bWalking)
|
2018-05-02 06:32:59 +08:00
|
|
|
return GAMEMODE.BaseClass.PlayerStepSoundTime(GAMEMODE.BaseClass, pl, iType, bWalking) * 0.4
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:DoAnimationEvent(pl, event, data)
|
|
|
|
if event == PLAYERANIMEVENT_ATTACK_PRIMARY then
|
|
|
|
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
|
|
|
|
|
|
|
|
function CLASS:DoesntGiveFear(pl)
|
|
|
|
return pl.FeignDeath and pl.FeignDeath:IsValid()
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:PlayPainSound(pl)
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:EmitSound("ambient/creatures/teddy.wav", 65, math_random(140, 150))
|
|
|
|
pl.NextPainSound = CurTime() + 0.5
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:PlayDeathSound(pl)
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:EmitSound("ambient/voices/citizen_beaten"..math_random(5)..".wav", 70, math_random(140, 150))
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
if SERVER then
|
|
|
|
function CLASS:OnKilled(pl, attacker, inflictor, suicide, headshot, dmginfo)
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:FakeDeath(pl:LookupSequence("death_0"..math_random(4)), self.ModelScale)
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:PostOnKilled(pl, attacker, inflictor, suicide, headshot, dmginfo)
|
|
|
|
pl:SetZombieClass(GAMEMODE.DefaultZombieClass)
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:AltUse(pl)
|
|
|
|
pl:StartFeignDeath()
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
function CLASS:OnSpawned(pl)
|
|
|
|
local oldhands = pl:GetHands()
|
|
|
|
if IsValid(oldhands) then
|
|
|
|
oldhands:Remove()
|
|
|
|
end
|
|
|
|
|
|
|
|
local hands = ents.Create("zs_hands")
|
|
|
|
if hands:IsValid() then
|
|
|
|
hands:DoSetup(pl)
|
|
|
|
hands:Spawn()
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
2018-05-02 06:32:59 +08:00
|
|
|
end
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
if not CLIENT then return end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Icon = "zombiesurvival/killicons/gorechild"
|
|
|
|
|
|
|
|
local render_ModelMaterialOverride = render.ModelMaterialOverride
|
|
|
|
|
|
|
|
local matSheet = Material("models/props_c17/doll01")
|
|
|
|
function CLASS:DrawHands(pl, hands)
|
|
|
|
render_ModelMaterialOverride(matSheet)
|
|
|
|
|
|
|
|
hands:DrawModel()
|
|
|
|
|
|
|
|
render_ModelMaterialOverride(nil)
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
return true
|
|
|
|
end
|