NSTrigger: SetTeam() will now assign an InfoKey to the target, if it's a client.

This commit is contained in:
Marco Cawthorne 2022-12-30 13:54:28 -08:00
parent 4322f1fd93
commit b356994beb
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
3 changed files with 10 additions and 4 deletions

View File

@ -39,14 +39,14 @@ public:
virtual bool IsDead(void);
/** Returns if we're a player. That is a type of client that is built on top of NSClientPlayer. */
virtual bool IsPlayer(void);
/** Like ClientInputFrame and ServerInputFrame. However it's run on both. */
/** Like ClientInputFrame and ServerInputFrame, but run on both client and server at the same time. It is run before ClientInputFrame and ServerInputFrame. */
virtual void SharedInputFrame(void);
/* overrides */
virtual void OnRemoveEntity(void);
#ifdef CLIENT
/** Client: Called on the client to give a chance to override input variables before networking */
/** Client: Called on the client to give a chance to override input_* variables before networking them takes place. */
virtual void ClientInputFrame(void);
/** Client: Called every single client frame when this client is alive */
@ -63,8 +63,7 @@ public:
#endif
#ifdef SERVER
/** Server: Like ClientInputFrame, but run on the server.
It's the first method to be called after receiving the input variables from the client.*/
/** Server: This is where the input* variables arrive after sending them out from the client (see ClientInputFrame).*/
virtual void ServerInputFrame(void);
/** Set the value of an InfoKey. */

View File

@ -17,6 +17,7 @@
void
NSClient::NSClient(void)
{
customphysics = Empty; /* we don't want any engine physics to run on clients, ever. */
flags |= FL_CLIENT;
XR_Init(this);
}

View File

@ -234,6 +234,12 @@ void
NSTrigger::SetTeam(float new_team)
{
team = new_team;
/* update the InfoKey too if it's a client entity */
if (flags & FL_CLIENT) {
NSClient client = (NSClient)this;
client.SetInfoKey("*team", sprintf("%d", new_team));
}
}
float