# HG changeset patch # User Adam Kaminski # Date 1635042210 14400 # Sat Oct 23 22:23:30 2021 -0400 # Node ID 06e9878fff7d0e86e0f4f0d8b55d8e1d69ad5b51 # Parent 4b110185269e4214ce3eab17a7763a140d18f140 Fixed SetPlayerClass from being able to respawn players if they're out of lives. diff -r 4b110185269e -r 06e9878fff7d src/p_acs.cpp --- a/src/p_acs.cpp Sat Oct 23 19:09:22 2021 -0400 +++ b/src/p_acs.cpp Sat Oct 23 22:23:30 2021 -0400 @@ -7414,20 +7414,23 @@ if ( bRespawn && PLAYER_IsValidPlayerWithMo( args[0] ) ) { - APlayerPawn *pmo = player->mo; - player->playerstate = PST_REBORNNOINVENTORY; - - // [AK] Unmorph the player before respawning them with a new class. - if ( player->morphTics ) - P_UndoPlayerMorph( player, player ); - - // [AK] If we're the server, tell the clients to destroy the body. - if ( NETWORK_GetState() == NETSTATE_SERVER ) - SERVERCOMMANDS_DestroyThing( pmo ); - - pmo->Destroy(); - pmo = NULL; - GAMEMODE_SpawnPlayer( player - players ); + // [AK] Only respawn the player if they still have enough lives left. + if ( !GAMEMODE_AreLivesLimited() || GAMEMODE_GetState() < GAMESTATE_INPROGRESS || player->ulLivesLeft > 0 ) + { + APlayerPawn *pmo = player->mo; + player->playerstate = PST_REBORNNOINVENTORY; + + // [AK] Unmorph the player before respawning them with a new class. + if ( player->morphTics ) + P_UndoPlayerMorph( player, player ); + + // [AK] If we're the server, tell the clients to destroy the body. + if ( NETWORK_GetState() == NETSTATE_SERVER ) + SERVERCOMMANDS_DestroyThing( pmo ); + + pmo->Destroy(); + GAMEMODE_SpawnPlayer( player - players ); + } } return 1;