diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
| commit | 2736f498f30220b858fc6fac23e7ddc4a597df6d (patch) | |
| tree | 374ceadedb654b00e09dac321620a8320830f734 /gamemode/player_class/player_zombie.lua | |
| download | redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.gz redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.bz2 redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.zip | |
Inital commit
Diffstat (limited to 'gamemode/player_class/player_zombie.lua')
| -rw-r--r-- | gamemode/player_class/player_zombie.lua | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/gamemode/player_class/player_zombie.lua b/gamemode/player_class/player_zombie.lua new file mode 100644 index 0000000..f8333b1 --- /dev/null +++ b/gamemode/player_class/player_zombie.lua @@ -0,0 +1,93 @@ + +AddCSLuaFile() + +local PLAYER = {} + +function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed ) + + local len = velocity:Length() + local movement = 1.0 + + if len > 0.2 then + + movement = len / maxseqgroundspeed + + end + + rate = math.min( movement, 2 ) + + if self.Player:WaterLevel() >= 2 then + + rate = math.max( rate, 0.5 ) + + elseif !self.Player:IsOnGround() and len >= 1000 then + + rate = 0.1 + + end + + local weapon = self.Player:GetActiveWeapon() + + self.Player:SetPlaybackRate( rate ) + + if CLIENT then + + self:GrabEarAnimation() + self:MouthMoveAnimation() + + end + +end + +function PLAYER:CalcMainActivity( velocity ) + + self.Player.CalcIdeal = ACT_MP_STAND_IDLE + self.Player.CalcSeqOverride = self.Player:LookupSequence( "zombie_idle" ) + + local len2d = velocity:Length2D() + + if len2d > 1 then + + self.Player.CalcSeqOverride = self.Player:LookupSequence( "zombie_run" ) + + end + + return self.Player.CalcIdeal, self.Player.CalcSeqOverride + +end + +function PLAYER:DoAnimationEvent( event, data ) + + if event == PLAYERANIMEVENT_ATTACK_PRIMARY then + + self.Player:AnimRestartGesture( GESTURE_SLOT_CUSTOM, ACT_GMOD_GESTURE_RANGE_ZOMBIE, true ) + + return ACT_VM_PRIMARYATTACK + + elseif event == PLAYERANIMEVENT_ATTACK_SECONDARY then + + return ACT_VM_SECONDARYATTACK + + elseif event == PLAYERANIMEVENT_JUMP then + + self.Player.m_bJumping = true + self.Player.m_bFirstJumpFrame = true + self.Player.m_flJumpStartTime = CurTime() + + self.Player:AnimRestartMainSequence() + + return ACT_INVALID + + elseif event >= PLAYERANIMEVENT_FLINCH_CHEST and event <= PLAYERANIMEVENT_FLINCH_RIGHTLEG then + + self.Player:AnimRestartGesture( GESTURE_SLOT_FLINCH, ACT_FLINCH_PHYSICS, true ) + + return ACT_INVALID + + end + + return nil + +end + +player_manager.RegisterClass( "player_zombie", PLAYER, "player_base" )
\ No newline at end of file |
