NSGameRules: Add overridable methods ImpulseCommand(NSClient, float) and PlayerRequestRespawn(NSClientPlayer).

Game_Input, the game specific function every game had to implement will be
deprecated to streamline the overall codebase. Migrate custom impulses into your gamerule overrides.
This will make it much easier to separate cheat impulse from the multiplayer game too.
This commit is contained in:
Marco Cawthorne 2023-01-11 17:12:20 -08:00
parent fa8e335564
commit 179a95088f
Signed by: eukara
GPG key ID: CE2032F0A2882A22
2 changed files with 19 additions and 0 deletions

View file

@ -46,6 +46,8 @@ public:
virtual bool ConsoleCommand(NSClientPlayer,string);
/** Overridable: Called when a client issues a client command. */
virtual bool ClientCommand(NSClient,string);
/** Overridable: Called when a client issues an impulse command. */
virtual bool ImpulseCommand(NSClient, float);
/* client */
/** Overridable: Called when a NSClientPlayer joins the server. */
@ -66,6 +68,12 @@ public:
virtual void PlayerPain(NSClientPlayer);
/** Overridable: Called to check if a NSClientPlayer can attack. */
virtual bool PlayerCanAttack(NSClientPlayer);
/** Overridable: called when a NSClientPlayer requests a respawn.
In a multiplayer game, it'll put you back into the game as a player.
In a singleplayer game, it might load the most recent save.
@return True/false depending on the respawn succeeded. */
virtual bool PlayerRequestRespawn(NSClientPlayer);
/* level transitions */
/** Overridable: Called to set up new level parms for any NSClientPlayer. */

View file

@ -77,6 +77,11 @@ NSGameRules::ClientCommand(NSClient pl, string cmd)
{
return (false);
}
bool
NSGameRules::ImpulseCommand(NSClient pl, float num)
{
return (false);
}
/* client */
void
@ -476,6 +481,12 @@ NSGameRules::PlayerCanAttack(NSClientPlayer bp)
return true;
}
bool
NSGameRules::PlayerRequestRespawn(NSClientPlayer bp)
{
return false;
}
void
NSGameRules::ChatMessageAll(NSClient cl, string strMessage)
{