mirror of
https://github.com/nzp-team/quakec.git
synced 2025-04-09 11:34:52 +00:00
SERVER: Restart Dedicated Server when party is empty
This commit is contained in:
parent
c7805825c7
commit
2cc0ca7ed3
1 changed files with 18 additions and 0 deletions
|
@ -1048,6 +1048,12 @@ void() PutClientInServer =
|
|||
GameRestart_ResetPerkaColas();
|
||||
};
|
||||
|
||||
void() RestartDedicatedServer =
|
||||
{
|
||||
bprint(PRINT_HIGH, "[INFO]: Issuing server restart as player is connecting to an empty server.\n");
|
||||
localcmd("restart\n");
|
||||
}
|
||||
|
||||
//called when client disconnects from the server
|
||||
void() ClientDisconnect =
|
||||
{
|
||||
|
@ -1079,6 +1085,18 @@ void() ClientDisconnect =
|
|||
self.is_in_menu = 0;
|
||||
|
||||
#endif // FTE
|
||||
|
||||
// We can encounter a player count of zero if we are in a dedicated
|
||||
// server. If this is the case we should restart the current level
|
||||
// to prevent issues with a player joining mid-match stuck in spectator
|
||||
// mode, or spawning in at a high round not able to progress.
|
||||
if (player_count == 0) {
|
||||
// We need to use a temp entity for this to add a delay, else this
|
||||
// will interfere with SP games.
|
||||
entity tempe = spawn();
|
||||
tempe.think = RestartDedicatedServer;
|
||||
tempe.nextthink = time + 0.25;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue