This entity class represents every player client.
When clients connect via the connect command, they will findthemselves of type ncPlayer.
KEYS
- "armorProtection" : Amount of damage the armor absorbs.
- "armorBonus" : Armor point cost per health point.
PHYSICS KEYS
- "pm_accelerate" : Movement speed acceleration.
- "pm_airaccelerate" : Movement speed acceleration when in air.
- "pm_airstepsize" : In-air stepping size. You will be able to climb stair-steps this high.
- "pm_boxcenter" : When 1, will indicate that the [0,0,0] coordinate is at the center of the bounding box.
- "pm_boxwidth" : Width of the bounding box, in in-game units.
- "pm_crouchheight" : Physical height when crouched.
- "pm_crouchspeed" : Movement speed when crouched.
- "pm_crouchviewheight" : Eye height from local [0,0,0] player coordinate when crouched.
- "pm_edgefriction" : Friction value to use when near edges, helps to prevent falling off ledges.
- "pm_friction" : Friction value for when walking on ground.
- "pm_gravity" : Gravity for this player.
- "pm_jumpheight" : Jump height (vertical upwards velocity, units per second) the player can perform.
- "pm_maxviewpitch" : Maximum camera pitch.
- "pm_minviewpitch" : Minimum camera pitch.
- "pm_noclipaccelerate" : Movement speed acceleration when noclip/spectating.
- "pm_noclipspeed" : Movement speed when noclip/spectating.
- "pm_normalheight" : Physical height when standing.
- "pm_normalviewheight" : Eye height from local [0,0,0] player coordinate when standing.
- "pm_nospeedcap" : When 1, will enable limit-less bunnyhopping exploits.
- "pm_proneheight" : Physical height when prone.
- "pm_pronespeed" : Movement speed when prone.
- "pm_proneviewheight" : Eye height from local [0,0,0] player coordinate when prone.
- "pm_runspeed" : Movement speed when running.
- "pm_runfiring" : When 1, will enable firing weapons while running.
- "pm_stamina" : Stamina, the number of seconds you're able to run.
- "pm_staminarate" : The rate at which stamina replenishes.
- "pm_staminathreshold" : The stamina-value at which speed will be reduced.
- "pm_stepsize" : Stepping size. You will be able to climb stair-steps this high.
- "pm_stopspeed" : The speed at which the player stops moving.
- "pm_walkspeed" : Movement speed when walking (regular movement).
- "pm_wateraccelerate" : Movement speed acceleration, when underwater.
- "pm_waterjumpheight" : Jump height when underwater.
ANIMATION KEYS
- "act_idle" : Animation to play when standing still.
- "act_idle_crouch" : Animation to play when standing still, while crouched.
- "act_idle_prone" : Animation to play when standing still, while prone.
- "act_walk" : Animation to play when walking.
- "act_walk_crouch" : Animation to play when moving while crouched.
- "act_walk_prone" : Animation to play when moving while prone.
- "act_run" : Animation to play when running.
- "act_jump" : Animation to play when jumping in the air.
- "act_swim" : Animation to play when swimming underwater.
- "act_treadwater" : Animation to play when treading through water.
- "act_aim" : Torso animation to play when standing still, aiming your gun.
- "act_draw" : Torso animation to play when drawing a weapon.
- "act_attack" : Torso animation to play when attacking with a weapon.
- "act_reload" : Torso animation to play when reloading a weapon.
- Note
- Much like the rest of Nuclide, we abstracted animations through Activities. Read up on Activities before proceeding.
The player animation system that is built-into Nuclide allows for players to strafe, look up/down and flap character their mouths when they're talking on voice chat.
- "spine" : The bone to be treated as a spine bone. This one will be twisted according to the pitch of the first-person camera.
- "torsoStart" : First bone in the skeleton that belongs to the upper body/torso.
- "torsoStart" Last bone in the skeleton that belongs to the upper body/torso.
If your model format doesn't let you define activities, you can always force them in the decl.
Making Weapons Use Different Animation Sets
When a weapon sets an "animPrefix", it will switch to an alternative set of activities, but only if it is present. T
For example, if you're firing a weapon with the "animPrefix" set to foobar
while crouching, then we will first look if act_attack_crouch_foobar
is set, and if that doesn't exist it will check for act_attack_crouch
, and as a last resort possibly even act_attack
. The weapon and stance are optional, as you will see. This will also allow you to set up a fallback for any unknown stances.
A more colorful example, from Rad-Therapy, highlighting the fields relevant to player animation:
valve/decls/def/player.def
:
{
...
"model" "models/player.mdl"
"spine" "Bip01 Spine"
"torsoStart" "Bip01 Spine"
"torsoEnd" "Bip01 R Finger12"
"act_idle" "0"
"act_jump" "8"
"act_walk_crouch" "6"
"act_idle_crouch" "7"
"act_run" "12"
"act_walk" "13"
"act_aim" "16,14"
"act_attack" "17,15"
"act_aim_crowbar" "25"
"act_attack_crowbar" "26"
"act_aim_crouch_crowbar" "27"
"act_attack_crouch_crowbar" "28"
...
}
var playerAPI_t player
Access playerAPI_t functions using this variable.
Definition: api_func.h:362
entityDefAPI_t entityDef
Access entityDefAPI_t functions using this variable.
Definition: api.h:436
valve/decls/def/weapons/crowbar.def
:
{
...
"model_player" "models/p_crowbar.mdl"
"animPrefix" "crowbar"
...
}
With the above definitions, the crowbar will select the activities for act_aim_crowbar
instead of act_aim
, same with act_attack
- in both regular and crouched stance.
|
void | ncPlayer (void) |
|
virtual void | PlayGesture (float gestureAnim, float overrideTime) |
|
virtual void | ProcessInput (void) |
| Called within the class to deal with the final input handling of the client. More...
|
|
virtual void | PreFrame (void) |
| Run once, every frame, before physics are run on the player. More...
|
|
virtual void | PostFrame (void) |
| Run once, every frame, after physics are run on the player. More...
|
|
virtual void | Physics_Fall (float) |
|
virtual void | Physics_Crouch (void) |
|
virtual void | Physics_Prone (void) |
|
virtual void | Physics_Jump (void) |
|
virtual void | Physics_CheckJump (float) |
|
virtual void | Physics_SetViewParms (void) |
|
virtual void | Physics_WaterJump (void) |
|
virtual void | Physics_WaterMove (void) |
|
virtual float | Physics_MaxSpeed (void) |
|
virtual void | Physics_InputPreMove (void) |
|
virtual void | Physics_InputPostMove (void) |
|
virtual void | Physics_Run (void) |
| Overridable: Called when the entity is ready to move. More...
|
|
virtual bool | IsFakeSpectator (void) |
| Returns if we're a 'fake' spectator. More...
|
|
virtual bool | IsRealSpectator (void) |
| Returns if we're a 'real' spectator. More...
|
|
virtual bool | IsDead (void) |
| Returns if we're considered 'dead'. More...
|
|
virtual bool | IsPlayer (void) |
| Returns if we're a player. More...
|
|
virtual void | SharedInputFrame (void) |
| Like ClientInputFrame and ServerInputFrame, but run on both client and server at the same time. More...
|
|
virtual bool | CanSprint (void) |
| Overridable: Returns whether the client can sprint, with the command +sprint. More...
|
|
virtual bool | CanProne (void) |
| Overridable: Returns whether the client can prone, with the commands +prone and goprone. More...
|
|
virtual bool | CanCrouch (void) |
| Overridable: Returns whether the client can crouch, with the commands +crouch and gocrouch. More...
|
|
virtual bool | CanLean (void) |
| Overridable: Returns whether the client can lean, with the commands +leanleft and +leanright. More...
|
|
virtual void | UpdatePlayerAnimation (float) |
| Empty & shared between Client and Server. More...
|
|
virtual void | Damage (entity, entity, ncDict, float, vector, vector) |
| Applies damage to the entity. More...
|
|
virtual bool | CanPickupEntity (ncEntity toPickUp, float massLimit, float sizeLimit) |
|
virtual void | VehicleRelink (void) |
|
virtual void | OnRemoveEntity (void) |
| Handles what happens before the entity gets removed from the client game. More...
|
|
virtual void | ReceiveEntity (float, float) |
| Client: Handles network updates from the server for the associated entity. More...
|
|
virtual void | _ReceiveComplete (float, float) |
| Called once ReceiveEntity has done its job. More...
|
|
virtual void | PredictPreFrame (void) |
|
virtual void | PredictPostFrame (void) |
|
virtual void | ClientInputFrame (void) |
| Client: Called on the client to give a chance to override input_* variables before networking them takes place. More...
|
|
virtual vector | CalculateLean (vector) |
|
virtual void | UpdateAliveCam (void) |
| Client: Called every single client frame when this client is alive. More...
|
|
virtual void | UpdatePlayerJaw (float) |
| Empty. More...
|
|
virtual void | UpdatePlayerAttachments (bool) |
| Empty. More...
|
|
virtual float | predraw (void) |
|
virtual void | postdraw (void) |
| Client: Run after the rendering of 3D world is complete. More...
|
|
virtual void | Save (float) |
| Handles saving a copy of this entity to a given filehandle. More...
|
|
virtual void | Restore (string, string) |
| Similar to ncIO::SpawnKey() but for save-game fields. More...
|
|
virtual void | Spawned (void) |
| Called when the entity is fulled initialized. More...
|
|
virtual void | Respawn (void) |
| Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state. More...
|
|
virtual void | EvaluateEntity (void) |
| Run each tic after physics are run to determine if we need to send updates over the network. More...
|
|
virtual float | SendEntity (entity, float) |
| Called by the engine whenever we need to send a client an update about this entity. More...
|
|
virtual void | Death (entity, entity, int, vector, vector, int) |
| Called when the health is equal or below 0. More...
|
|
virtual void | ServerInputFrame (void) |
| Server: This is where the input* variables arrive after sending them out from the client (see ClientInputFrame). More...
|
|
virtual void | Input (entity, string, string) |
| Called when we are being prompted by another object/function with an input message. More...
|
|
virtual float | OptimiseChangedFlags (entity, float) |
| Helper function that will optimise the changed-flags of your player entity. More...
|
|
virtual void | MakePlayer (void) |
| When called, will turn the client into a proper player. More...
|
|
virtual void | MakeTempSpectator (void) |
| When called, will turn the client into a spectator until the next round. More...
|
|
virtual void | MakeSpectator (void) |
| When called, will turn the client into a general spectator. More...
|
|
virtual void | InputUse_Down (void) |
| Called when we press the button bound to +use. More...
|
|
virtual void | InputUse_Up (void) |
| Called when we let go of the button bound to +use. More...
|
|
virtual bool | CanPickupEntity (ncEntity, float, float) |
|
nonvirtual void | PickupEntity (ncEntity) |
|
nonvirtual float | WeaponAnimTime (void) |
|
virtual void | Footsteps_Update (void) |
|