From bef240a1de558d3ce546abda4d2cf78445e9e692 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 11 Jan 2023 18:04:17 -0800 Subject: [PATCH] HLMultiplayerRules: add PlayerRequestSpawn method override --- src/server/gamerules.h | 18 ++++++++++-------- src/server/gamerules_multiplayer.qc | 11 +++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/server/gamerules.h b/src/server/gamerules.h index 3aab4f5..6ecef05 100644 --- a/src/server/gamerules.h +++ b/src/server/gamerules.h @@ -16,16 +16,17 @@ class HLGameRules:CGameRules { - virtual void(NSClientPlayer) PlayerConnect; - virtual void(NSClientPlayer) PlayerDisconnect; - virtual void(NSClientPlayer) PlayerKill; - virtual void(NSClientPlayer) PlayerPostFrame; + virtual void PlayerConnect(NSClientPlayer); + virtual void PlayerDisconnect(NSClientPlayer); + virtual void PlayerKill(NSClientPlayer); + virtual void PlayerPostFrame(NSClientPlayer); - virtual void(NSClientPlayer) LevelDecodeParms; - virtual void(NSClientPlayer) LevelChangeParms; - virtual void(void) LevelNewParms; + virtual void LevelDecodeParms(NSClientPlayer); + virtual void LevelChangeParms(NSClientPlayer); + virtual void LevelNewParms(void); + + virtual bool IsMultiplayer(void); - virtual bool(void) IsMultiplayer; virtual bool ImpulseCommand(NSClient, float); }; @@ -57,4 +58,5 @@ class HLMultiplayerRules:HLGameRules virtual bool(void) IsMultiplayer; virtual bool(void) IsTeamplay; virtual void(void) InitPostEnts; + virtual bool PlayerRequestRespawn(NSClientPlayer); }; diff --git a/src/server/gamerules_multiplayer.qc b/src/server/gamerules_multiplayer.qc index 2cc757f..2c739e7 100644 --- a/src/server/gamerules_multiplayer.qc +++ b/src/server/gamerules_multiplayer.qc @@ -23,6 +23,17 @@ HLMultiplayerRules::IsMultiplayer(void) return true; } +bool +HLMultiplayerRules::PlayerRequestRespawn(NSClientPlayer bp) +{ + if (bp.TimeSinceDeath() > 0.5f) { + bp.ScheduleThink(PutClientInServer, 0.0f); + return true; + } + + return false; +} + bool HLMultiplayerRules::IsTeamplay(void) {