Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GM:CalcMainActivity( ply, velocity )
- // Define defaults
- local ideal = (ply.AggrStance and ACT_IDLE_ANGRY_MELEE) or ACT_IDLE
- local wep = ply:GetActiveWeapon()
- local SHOTGUN = false
- if (IsValid( wep )) then
- local class = wep:GetClass()
- if (class == "weapon_shotgun") then SHOTGUN = true end
- if (class == "weapon_grymod_scar") then RIFLE = true end
- else
- RIFLE = false
- SHOTGUN = false
- end
- local seq = -1
- if (SHOTGUN) then ideal = (ply.AggrStance and ACT_IDLE_SHOTGUN_AGITATED) or ACT_IDLE_SHOTGUN_RELAXED end
- if (RIFLE) then ideal = ACT_IDLE_ANGRY_SMG1 end
- // Determine speed
- local len2d = velocity:Length2D()
- local RUNNING = ((len2d >= 180) )
- local WALKING = (len2d > 0 and !RUNNING)
- local SRUNNING = ((len2d >= 500) and (ply:GetNWBool("Speed",true)) and !RIFLE)
- if (RUNNING or WALKING) then ply.AggrStance = false end
- // Are we crouching?
- if (ply:Crouching()) then
- ideal = ACT_COVER_LOW_RPG
- if (RIFLE && !WALKING && !RUNNIING) then seq = "crouch_aim_smg1" end
- if (WALKING) then ideal = ACT_RUN_CROUCH end
- if (RUNNING) then ideal = ACT_RUN_CROUCH end
- if (WALKING && RIFLE) then seq = "crouchrunaimingall1" end
- if (RUNNING && RIFLE) then seq = "crouchrunholdingall1" end
- --if (WALKING || RUNNING) && SHOTGUN then ideal = ACT_WALK_CROUCH_RIFLE end
- if ply:Health() < 30 then ideal = ACT_RUN_PROTECTED end
- else
- if (WALKING) then ideal = ACT_RUN end
- if (RUNNING) then ideal = ACT_RUN end
- if (SRUNNING) then seq = "sprint_all" end
- if (WALKING && RIFLE) then ideal = ACT_WALK_AIM_RIFLE end
- if RUNNING && RIFLE then seq = "run_AR2_Relaxed_all" end
- -- if RUNNING && RIFLE then ideal = ACT_RUN_RIFLE end
- --if (WALKING || RUNNING) && SHOTGUN then ideal = ACT_WALK_RIFLE_RELAXED end
- end
- local eyeAngles = ply:EyeAngles();
- local yaw = velocity:Angle().yaw;
- local normalized = math.NormalizeAngle(yaw - eyeAngles.y);
- ply:SetPoseParameter("move_yaw", normalized);
- // Return
- return ideal, ply:LookupSequence(seq)
- end
- function GM:TranslateActivity( ply, act )
- /*local aggr = ply:GetAggr()
- if (!aggr) then return act end
- local wep = ply:GetActiveWeapon()
- if (!IsValid( wep )) then return act end
- local class = wep:GetClass()
- local trans = Translate[ class ]
- if (!trans) then return act end
- return trans[ act ] or act*/
- return act
- end
- function GM:DoAnimationEvent( ply, event, data )
- if event == PLAYERANIMEVENT_ATTACK_PRIMARY then
- local wep = ply:GetActiveWeapon()
- if (!IsValid( wep )) then return end
- local class = wep:GetClass()
- if (SERVER) then
- if (class == "weapon_crowbar") || (wep.IsMelee) then
- ply:PlayAction( ACT_MELEE_ATTACK_SWING, 0.8 )
- end
- if (class == "weapon_shotgun") then
- ply:PlayAction( ACT_RANGE_ATTACK_SHOTGUN, 0.8 )
- end
- end
- ply.AggrStance = true
- return ACT_VM_PRIMARYATTACK
- elseif event == PLAYERANIMEVENT_RELOAD then
- if ply:Crouching() then
- ply:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_CROUCH )
- else
- ply:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_STAND )
- end
- return ACT_INVALID
- elseif event == PLAYERANIMEVENT_JUMP then
- ply.m_bJumping = true
- ply.m_bFirstJumpFrame = true
- ply.m_flJumpStartTime = CurTime()
- ply:AnimRestartMainSequence()
- return ACT_INVALID
- elseif event == PLAYERANIMEVENT_CANCEL_RELOAD then
- ply:AnimResetGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD )
- return ACT_INVALID
- end
- return nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement