zombiesurvival-evolved/gamemodes/zombiesurvival/gamemode/zombieclasses/wraith.lua

164 lines
4.4 KiB
Lua
Raw Normal View History

2014-10-02 08:49:54 +08:00
CLASS.Name = "Wraith"
CLASS.TranslationName = "class_wraith"
CLASS.Description = "description_wraith"
CLASS.Help = "controls_wraith"
CLASS.BetterVersion = "Tormented Wraith"
CLASS.Wave = 0
CLASS.Unlocked = true
CLASS.Health = 135
2014-10-02 08:49:54 +08:00
CLASS.SWEP = "weapon_zs_wraith"
CLASS.Model = Model("models/player/zelpa/stalker.mdl")
CLASS.Speed = 150
2014-10-02 08:49:54 +08:00
CLASS.CanTaunt = true
CLASS.Points = CLASS.Health/GM.NoHeadboxZombiePointRatio
2014-10-02 08:49:54 +08:00
CLASS.VoicePitch = 0.65
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("zombiesurvival/wraithdeath1.ogg"), Sound("zombiesurvival/wraithdeath2.ogg"), Sound("zombiesurvival/wraithdeath3.ogg"), Sound("zombiesurvival/wraithdeath4.ogg")}
CLASS.NoShadow = true
CLASS.IgnoreTargetAssist = true
CLASS.RenderMode = RENDERMODE_TRANSALPHA -- Prevents flashlight shadows
CLASS.BloodColor = BLOOD_COLOR_MECH
local math_min = math.min
local math_Clamp = math.Clamp
local IN_SPEED = IN_SPEED
local ACT_HL2MP_SWIM_PISTOL = ACT_HL2MP_SWIM_PISTOL
local ACT_HL2MP_IDLE_CROUCH_FIST = ACT_HL2MP_IDLE_CROUCH_FIST
local ACT_HL2MP_IDLE_KNIFE = ACT_HL2MP_IDLE_KNIFE
local ACT_HL2MP_WALK_CROUCH_KNIFE = ACT_HL2MP_WALK_CROUCH_KNIFE
local ACT_HL2MP_WALK_KNIFE = ACT_HL2MP_WALK_KNIFE
local ACT_HL2MP_RUN_KNIFE = ACT_HL2MP_RUN_KNIFE
local PLAYERANIMEVENT_ATTACK_PRIMARY = PLAYERANIMEVENT_ATTACK_PRIMARY
local GESTURE_SLOT_ATTACK_AND_RELOAD = GESTURE_SLOT_ATTACK_AND_RELOAD
local ACT_GMOD_GESTURE_RANGE_ZOMBIE_SPECIAL = ACT_GMOD_GESTURE_RANGE_ZOMBIE_SPECIAL
local ACT_GMOD_GESTURE_TAUNT_ZOMBIE = ACT_GMOD_GESTURE_TAUNT_ZOMBIE
local ACT_INVALID = ACT_INVALID
2014-10-02 08:49:54 +08:00
function CLASS:Move(pl, move)
if pl:KeyDown(IN_SPEED) then
move:SetMaxSpeed(40)
move:SetMaxClientSpeed(40)
2014-10-02 08:49:54 +08:00
end
end
function CLASS:CalcMainActivity(pl, velocity)
if pl:WaterLevel() >= 3 then
return ACT_HL2MP_SWIM_PISTOL, -1
end
2014-10-02 08:49:54 +08:00
if pl:WaterLevel() >= 3 then
return ACT_HL2MP_SWIM_PISTOL, -1
end
2014-10-02 08:49:54 +08:00
local len = velocity:Length2DSqr()
if len <= 1 then
if pl:Crouching() and pl:OnGround() then
return ACT_HL2MP_IDLE_CROUCH_FIST, -1
end
return ACT_HL2MP_IDLE_KNIFE, -1
2014-10-02 08:49:54 +08:00
end
if pl:Crouching() and pl:OnGround() then
return ACT_HL2MP_WALK_CROUCH_KNIFE, -1
end
if len < 2800 then
return ACT_HL2MP_WALK_KNIFE, -1
end
return ACT_HL2MP_RUN_KNIFE, -1
2014-10-02 08:49:54 +08:00
end
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
local len2d = velocity:Length()
if len2d > 1 then
pl:SetPlaybackRate(math_min(len2d / maxseqgroundspeed, 3))
else
pl:SetPlaybackRate(1)
end
2014-10-02 08:49:54 +08:00
return true
end
function CLASS:DoAnimationEvent(pl, event, data)
if event == PLAYERANIMEVENT_ATTACK_PRIMARY then
pl:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_RANGE_ZOMBIE_SPECIAL, true)
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
2014-10-02 08:49:54 +08:00
--[[function CLASS:ScalePlayerDamage(pl, hitgroup, dmginfo)
2014-10-02 08:49:54 +08:00
-- The Wraith model doesn't have hitboxes.
return true
end]]
2014-10-02 08:49:54 +08:00
function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
return true
2014-10-02 08:49:54 +08:00
end
function CLASS:GetAlpha(pl)
local wep = pl:GetActiveWeapon()
if not wep.IsAttacking then wep = NULL end
if wep:IsValid() and wep:IsAttacking() then
return 0.7
end
local eyepos = EyePos()
local nearest = pl:WorldSpaceCenter()
local norm = nearest - eyepos
norm:Normalize()
local dot = EyeVector():Dot(norm)
local vis = (dot * 0.4 + pl:GetVelocity():Length() / self.Speed / 2 - eyepos:Distance(nearest) / 400) * dot
return math_Clamp(vis, MySelf:IsValid() and MySelf:Team() == TEAM_UNDEAD and 0.137 or 0, 0.7)
2014-10-02 08:49:54 +08:00
end
if SERVER then
2014-10-02 08:49:54 +08:00
function CLASS:OnKilled(pl, attacker, inflictor, suicide, headshot, dmginfo, assister)
local effectdata = EffectData()
effectdata:SetOrigin(pl:GetPos())
effectdata:SetNormal(pl:GetForward())
effectdata:SetEntity(pl)
util.Effect("death_wraith", effectdata, nil, true)
2014-10-02 08:49:54 +08:00
return true
end
end
2014-10-02 08:49:54 +08:00
if not CLIENT then return end
CLASS.Icon = "zombiesurvival/killicons/wraithv2"
function CLASS:PrePlayerDraw(pl)
--pl:RemoveAllDecals()
local alpha = self:GetAlpha(pl)
if alpha == 0 then return true end
render.SetBlend(alpha)
render.SetColorModulation(0.025, 0.025, 0.1)
render.SuppressEngineLighting(true)
2014-10-02 08:49:54 +08:00
end
function CLASS:PostPlayerDraw(pl)
render.SuppressEngineLighting(false)
2014-10-02 08:49:54 +08:00
render.SetColorModulation(1, 1, 1)
render.SetBlend(1)
end