2014-10-02 08:49:54 +08:00
|
|
|
CLASS.Name = "Flesh Creeper"
|
|
|
|
CLASS.TranslationName = "class_flesh_creeper"
|
|
|
|
CLASS.Description = "description_flesh_creeper"
|
|
|
|
CLASS.Help = "controls_flesh_creeper"
|
|
|
|
|
|
|
|
CLASS.Wave = 0
|
|
|
|
CLASS.Hidden = true
|
|
|
|
CLASS.Unlocked = true
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.NotRandomStart = true
|
|
|
|
|
|
|
|
CLASS.Health = 175
|
2014-10-02 08:49:54 +08:00
|
|
|
CLASS.SWEP = "weapon_zs_fleshcreeper"
|
|
|
|
CLASS.Model = Model("models/antlion.mdl")
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Speed = 160
|
2014-11-07 13:03:40 +08:00
|
|
|
CLASS.JumpPower = 220
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Points = CLASS.Health/GM.NoHeadboxZombiePointRatio
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
CLASS.VoicePitch = 0.55
|
|
|
|
|
|
|
|
CLASS.PainSounds = {Sound("npc/barnacle/barnacle_pull1.wav"), Sound("npc/barnacle/barnacle_pull2.wav"), Sound("npc/barnacle/barnacle_pull3.wav"), Sound("npc/barnacle/barnacle_pull4.wav")}
|
|
|
|
CLASS.DeathSounds = {Sound("npc/barnacle/barnacle_die1.wav"), Sound("npc/barnacle/barnacle_die2.wav")}
|
|
|
|
|
|
|
|
CLASS.ModelScale = 0.65
|
|
|
|
--[[CLASS.ModelScale = 0.6324555
|
|
|
|
CLASS.ClientsideModelScale = 0.4 / CLASS.ModelScale]]
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Hull = {Vector(-16, -16, 0), Vector(16, 16, 36)}
|
|
|
|
CLASS.HullDuck = {Vector(-16, -16, 0), Vector(16, 16, 36)}
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.ViewOffset = Vector(0, 0, 35.5)
|
|
|
|
CLASS.ViewOffsetDucked = Vector(0, 0, 35.5)
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
local CurTime = CurTime
|
|
|
|
local math_random = math.random
|
|
|
|
local math_sin = math.sin
|
|
|
|
local IN_JUMP = IN_JUMP
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
function CLASS:CanUse(pl)
|
|
|
|
return GAMEMODE:GetDynamicSpawning() and not GAMEMODE.ZombieEscape
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:Move(pl, mv)
|
|
|
|
local wep = pl:GetActiveWeapon()
|
2018-05-02 06:32:59 +08:00
|
|
|
if wep.Move and wep:Move(mv) then
|
2014-10-02 08:49:54 +08:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
if mv:GetForwardSpeed() <= 0 then
|
|
|
|
mv:SetMaxSpeed(mv:GetMaxSpeed() * 0.45)
|
|
|
|
mv:SetMaxClientSpeed(mv:GetMaxClientSpeed() * 0.45)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:CalcMainActivity(pl, velocity)
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep:IsValid() and wep.IsInAttackAnim then
|
|
|
|
if wep:IsInAttackAnim() then
|
2018-05-02 06:32:59 +08:00
|
|
|
return 1, 14
|
|
|
|
end
|
|
|
|
|
|
|
|
if wep:GetHoldingRightClick() then
|
|
|
|
return 1, 21
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if wep.IsPouncing and wep:IsPouncing() then
|
|
|
|
return ACT_GLIDE, -1
|
|
|
|
end
|
|
|
|
|
|
|
|
if velocity:Length2DSqr() > 1 then
|
2014-10-02 08:49:54 +08:00
|
|
|
--[[if pl:Crouching() and pl:OnGround() then
|
2018-05-02 06:32:59 +08:00
|
|
|
return 1, 17
|
2014-10-02 08:49:54 +08:00
|
|
|
else]]
|
2018-05-02 06:32:59 +08:00
|
|
|
return 1, 4
|
2014-10-02 08:49:54 +08:00
|
|
|
--[[end
|
|
|
|
elseif pl:Crouching() and pl:OnGround() then
|
|
|
|
pl.CalcSeqOverride = 40]]
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
|
|
|
|
return 1, 2
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep:IsValid() and wep.IsInAttackAnim then
|
|
|
|
if wep:IsInAttackAnim() then
|
|
|
|
pl:SetPlaybackRate(0)
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:SetCycle(1 - (wep:GetAttackAnimTime() - CurTime()) / wep.Primary.Delay)
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
return true
|
|
|
|
elseif wep:GetHoldingRightClick() then
|
|
|
|
pl:SetPlaybackRate(0)
|
|
|
|
|
|
|
|
local delta = CurTime() - wep:GetRightClickStart()
|
|
|
|
if delta > 1 then
|
|
|
|
--pl:SetCycle(0.333 + (delta * 3 % 1) * 0.2)
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:SetCycle(0.5 + math_sin(delta * 12) * 0.05)
|
2014-10-02 08:49:54 +08:00
|
|
|
else
|
|
|
|
--pl:SetCycle(delta / 3)
|
|
|
|
pl:SetCycle(delta / 2)
|
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if velocity:Length2DSqr() >= 256 then
|
2014-10-02 08:49:54 +08:00
|
|
|
GAMEMODE.BaseClass.UpdateAnimation(GAMEMODE.BaseClass, pl, velocity, maxseqgroundspeed)
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
--[[local dir = Vector(0, 0, 0)
|
2014-10-02 08:49:54 +08:00
|
|
|
dir:Set(velocity)
|
|
|
|
dir.z = 0
|
|
|
|
dir:Normalize()
|
|
|
|
local aimdir = pl:GetAimVector()
|
|
|
|
aimdir.z = 0
|
|
|
|
aimdir:Normalize()
|
|
|
|
|
|
|
|
if dir:Dot(aimdir) >= 0.5 then
|
|
|
|
pl:SetPlaybackRate(pl:GetPlaybackRate() / self.ModelScale / 2)
|
|
|
|
else]]
|
|
|
|
pl:SetPlaybackRate(pl:GetPlaybackRate() / self.ModelScale)
|
|
|
|
--end
|
|
|
|
|
|
|
|
--[[if pl:Crouching() then
|
|
|
|
pl:SetPoseParameter("move_yaw", 0)
|
|
|
|
end]]
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[if pl:Crouching() then
|
|
|
|
pl:SetCycle(0.5 + math.sin(CurTime() * 2) * 0.025)
|
|
|
|
pl:SetPlaybackRate(0)
|
|
|
|
|
|
|
|
return true
|
|
|
|
end]]
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:DoAnimationEvent(pl, event, data)
|
|
|
|
if event == PLAYERANIMEVENT_ATTACK_PRIMARY then
|
|
|
|
return ACT_INVALID
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:CreateMove(pl, cmd)
|
|
|
|
local wep = pl:GetActiveWeapon()
|
|
|
|
if wep:IsValid() and wep.IsSwinging and wep:IsSwinging() and bit.band(cmd:GetButtons(), IN_JUMP) ~= 0 then
|
|
|
|
cmd:SetButtons(cmd:GetButtons() - IN_JUMP)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local FootSounds = {
|
|
|
|
"npc/zombie/foot1.wav",
|
|
|
|
"npc/zombie/foot2.wav",
|
|
|
|
"npc/zombie/foot3.wav"
|
|
|
|
}
|
|
|
|
function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
|
2018-05-02 06:32:59 +08:00
|
|
|
pl:EmitSound(FootSounds[math_random(#FootSounds)], 65, math.random(105, 115))
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
if SERVER then
|
|
|
|
function CLASS:OnKilled(pl, attacker, inflictor, suicide, headshot, dmginfo)
|
|
|
|
local ent = pl:FakeDeath(pl:LookupSequence("Flip1"), self.ModelScale, math.Rand(0.45, 0.5))
|
|
|
|
if ent:IsValid() then
|
|
|
|
ent:SetMaterial("models/flesh")
|
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if not CLIENT then return end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
CLASS.Icon = "zombiesurvival/killicons/fleshcreeper"
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
local matFlesh = Material("models/flesh")
|
|
|
|
function CLASS:PrePlayerDraw(pl)
|
|
|
|
render.ModelMaterialOverride(matFlesh)
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:PostPlayerDraw(pl)
|
|
|
|
render.ModelMaterialOverride()
|
|
|
|
end
|
|
|
|
|
|
|
|
function CLASS:ShouldDrawLocalPlayer()
|
|
|
|
return true
|
|
|
|
end
|