Nuclide
Software Development Kit for id Technology (BETA)
ncPlayer Class Reference

About this class

This entity class represents every player client.

When clients connect via the connect command, they will findthemselves of type ncPlayer.

Inheritance diagram for ncPlayer:
ncSpectator

Public Member Functions

void ncPlayer (void)
 
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)
 
virtual void Footsteps_Update (void)
 
nonvirtual void _UpdatePMoveVars (void)
 

Constructor & Destructor Documentation

◆ ncPlayer()

void ncPlayer::ncPlayer ( void  )

Member Function Documentation

◆ _ReceiveComplete()

void ncPlayer::_ReceiveComplete ( float  flNew,
float  flChanged 
)
virtual

Called once ReceiveEntity has done its job.

Reimplemented from ncEntity.

◆ _UpdatePMoveVars()

void ncPlayer::_UpdatePMoveVars ( void  )

◆ CalculateLean()

vector ncPlayer::CalculateLean ( vector  viewAngle)
virtual

◆ CanCrouch()

bool ncPlayer::CanCrouch ( void  )
virtual

Overridable: Returns whether the client can crouch, with the commands +crouch and gocrouch.

Reimplemented from ncActor.

◆ CanLean()

bool ncPlayer::CanLean ( void  )
virtual

Overridable: Returns whether the client can lean, with the commands +leanleft and +leanright.

Reimplemented from ncActor.

◆ CanPickupEntity() [1/2]

bool ncPlayer::CanPickupEntity ( ncEntity  toPickUp,
float  massLimit,
float  sizeLimit 
)
virtual

◆ CanPickupEntity() [2/2]

virtual bool ncPlayer::CanPickupEntity ( ncEntity  ,
float  ,
float   
)
virtual

◆ CanProne()

bool ncPlayer::CanProne ( void  )
virtual

Overridable: Returns whether the client can prone, with the commands +prone and goprone.

Reimplemented from ncActor.

◆ CanSprint()

bool ncPlayer::CanSprint ( void  )
virtual

Overridable: Returns whether the client can sprint, with the command +sprint.

Reimplemented from ncActor.

◆ ClientInputFrame()

void ncPlayer::ClientInputFrame ( void  )
virtual

Client: Called on the client to give a chance to override input_* variables before networking them takes place.

Reimplemented from ncSpectator.

◆ Damage()

void ncPlayer::Damage ( entity  inflictor,
entity  attacker,
ncDict  damageDecl,
float  damageScale,
vector  dmgDir,
vector  hitLocation 
)
virtual

Applies damage to the entity.

Reimplemented from ncSurfacePropEntity.

◆ Death()

virtual void ncPlayer::Death ( entity  inflictor,
entity  attacker,
int  damage,
vector  dir,
vector  absImpactPos,
int  hitBody 
)
virtual

Called when the health is equal or below 0.

Reimplemented from ncSurfacePropEntity.

◆ EvaluateEntity()

virtual void ncPlayer::EvaluateEntity ( void  )
virtual

Run each tic after physics are run to determine if we need to send updates over the network.

Reimplemented from ncSpectator.

◆ Footsteps_Update()

void ncPlayer::Footsteps_Update ( void  )
virtual

◆ Input()

virtual void ncPlayer::Input ( entity  eAct,
string  strInput,
string  strData 
)
virtual

Called when we are being prompted by another object/function with an input message.

Reimplemented from ncActor.

◆ InputUse_Down()

virtual void ncPlayer::InputUse_Down ( void  )
virtual

Called when we press the button bound to +use.

◆ InputUse_Up()

virtual void ncPlayer::InputUse_Up ( void  )
virtual

Called when we let go of the button bound to +use.

◆ IsDead()

bool ncPlayer::IsDead ( void  )
virtual

Returns if we're considered 'dead'.

ncClient, ncSpectator will always return false.

Reimplemented from ncSpectator.

◆ IsFakeSpectator()

bool ncPlayer::IsFakeSpectator ( void  )
virtual

Returns if we're a 'fake' spectator.

This is a regular player acting as a spectator.

Reimplemented from ncSpectator.

◆ IsPlayer()

bool ncPlayer::IsPlayer ( void  )
virtual

Returns if we're a player.

That is a type of client that is built on top of ncPlayer.

Reimplemented from ncSpectator.

◆ IsRealSpectator()

bool ncPlayer::IsRealSpectator ( void  )
virtual

Returns if we're a 'real' spectator.

That is a client that can only spectate.

Reimplemented from ncSpectator.

◆ MakePlayer()

virtual void ncPlayer::MakePlayer ( void  )
virtual

When called, will turn the client into a proper player.

◆ MakeSpectator()

virtual void ncPlayer::MakeSpectator ( void  )
virtual

When called, will turn the client into a general spectator.

◆ MakeTempSpectator()

virtual void ncPlayer::MakeTempSpectator ( void  )
virtual

When called, will turn the client into a spectator until the next round.

◆ OnRemoveEntity()

void ncPlayer::OnRemoveEntity ( void  )
virtual

Handles what happens before the entity gets removed from the client game.

Reimplemented from ncClient.

◆ OptimiseChangedFlags()

virtual float ncPlayer::OptimiseChangedFlags ( entity  ,
float   
)
virtual

Helper function that will optimise the changed-flags of your player entity.

◆ Physics_CheckJump()

void ncPlayer::Physics_CheckJump ( float  premove)
virtual

◆ Physics_Crouch()

void ncPlayer::Physics_Crouch ( void  )
virtual

◆ Physics_Fall()

void ncPlayer::Physics_Fall ( float  flDownforce)
virtual

◆ Physics_InputPostMove()

void ncPlayer::Physics_InputPostMove ( void  )
virtual

◆ Physics_InputPreMove()

void ncPlayer::Physics_InputPreMove ( void  )
virtual

◆ Physics_Jump()

void ncPlayer::Physics_Jump ( void  )
virtual

◆ Physics_MaxSpeed()

float ncPlayer::Physics_MaxSpeed ( void  )
virtual

◆ Physics_Prone()

void ncPlayer::Physics_Prone ( void  )
virtual

◆ Physics_Run()

void ncPlayer::Physics_Run ( void  )
virtual

Overridable: Called when the entity is ready to move.

When overridden, will no longer move until super function is called, or physics is handled within.

Reimplemented from ncActor.

◆ Physics_SetViewParms()

void ncPlayer::Physics_SetViewParms ( void  )
virtual

◆ Physics_WaterJump()

void ncPlayer::Physics_WaterJump ( void  )
virtual

◆ Physics_WaterMove()

void ncPlayer::Physics_WaterMove ( void  )
virtual

◆ PickupEntity()

nonvirtual void ncPlayer::PickupEntity ( ncEntity  )

◆ postdraw()

void ncPlayer::postdraw ( void  )
virtual

Client: Run after the rendering of 3D world is complete.

2D calls can happen here.

Reimplemented from ncRenderableEntity.

◆ PostFrame()

void ncPlayer::PostFrame ( void  )
virtual

Run once, every frame, after physics are run on the player.

Reimplemented from ncSpectator.

◆ PredictPostFrame()

void ncPlayer::PredictPostFrame ( void  )
virtual

◆ PredictPreFrame()

void ncPlayer::PredictPreFrame ( void  )
virtual

◆ predraw()

float ncPlayer::predraw ( void  )
virtual

Reimplemented from ncSpectator.

◆ PreFrame()

void ncPlayer::PreFrame ( void  )
virtual

Run once, every frame, before physics are run on the player.

Reimplemented from ncSpectator.

◆ ProcessInput()

void ncPlayer::ProcessInput ( void  )
virtual

Called within the class to deal with the final input handling of the client.

Reimplemented from ncSpectator.

◆ ReceiveEntity()

void ncPlayer::ReceiveEntity ( float  flNew,
float  flChanged 
)
virtual

Client: Handles network updates from the server for the associated entity.

Reimplemented from ncSpectator.

◆ Respawn()

virtual void ncPlayer::Respawn ( void  )
virtual

Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state.

Reimplemented from ncSurfacePropEntity.

◆ Restore()

virtual void ncPlayer::Restore ( string  strKey,
string  strValue 
)
virtual

Similar to ncIO::SpawnKey() but for save-game fields.

Whatever you write into file handles within your ncIO::Save() method needs to be read back in here.

Reimplemented from ncSpectator.

◆ Save()

virtual void ncPlayer::Save ( float  handle)
virtual

Handles saving a copy of this entity to a given filehandle.

Within you want to use the ncIO::SaveFloat() etc. methods to write the internal member attributes to the specified file handle.

Reimplemented from ncSpectator.

◆ SendEntity()

virtual float ncPlayer::SendEntity ( entity  ,
float   
)
virtual

Called by the engine whenever we need to send a client an update about this entity.

Reimplemented from ncSpectator.

◆ ServerInputFrame()

virtual void ncPlayer::ServerInputFrame ( void  )
virtual

Server: This is where the input* variables arrive after sending them out from the client (see ClientInputFrame).

This is also where we will instruct the server to run physics on the client.

Reimplemented from ncSpectator.

◆ SharedInputFrame()

void ncPlayer::SharedInputFrame ( void  )
virtual

Like ClientInputFrame and ServerInputFrame, but run on both client and server at the same time.

It is run before ClientInputFrame and ServerInputFrame. When overriding, Make sure to call the super method to enable Nuclide to handle spectator controls properly.

Reimplemented from ncSpectator.

◆ Spawned()

virtual void ncPlayer::Spawned ( void  )
virtual

Called when the entity is fulled initialized.

Any spawn key/value info pairs have already been dealt with. So now we can make full decisions on the entity. Always make sure to call super::Spawned(); inside your method when overriding.

Reimplemented from ncActor.

◆ UpdateAliveCam()

void ncPlayer::UpdateAliveCam ( void  )
virtual

Client: Called every single client frame when this client is alive.

You are expected to manipulate the g_view global here, which is of type ncView.

Reimplemented from ncClient.

◆ UpdatePlayerAnimation()

void ncPlayer::UpdatePlayerAnimation ( float  timelength)
virtual

Empty & shared between Client and Server.

This is run on every player, every frame, to update their animation cycle.

◆ UpdatePlayerAttachments()

void ncPlayer::UpdatePlayerAttachments ( bool  visible)
virtual

Empty.

This is run on every player, every frame to update attachments.

◆ UpdatePlayerJaw()

void ncPlayer::UpdatePlayerJaw ( float  voip_volume)
virtual

Empty.

Updates the bone controller responsible for mouth movement.

◆ VehicleRelink()

void ncPlayer::VehicleRelink ( void  )
virtual

The documentation for this class was generated from the following files: