Continue to allow cheating and some other commands after winning the game. Refs #3168.

This was SVN commit r18346.
This commit is contained in:
elexis 2016-06-09 14:47:25 +00:00
parent fab2e9274a
commit 4bb9c80001
2 changed files with 9 additions and 4 deletions

View file

@ -317,14 +317,13 @@ function getCheatsData()
/**
* Reads userinput from the chat and sends a simulation command in case it is a known cheat.
* Hence cheats won't be sent as chat over network.
*
* @param {string} text
* @returns {boolean} - True if a cheat was executed.
*/
function executeCheat(text)
{
if (g_IsObserver || !g_Players[Engine.GetPlayerID()].cheatsEnabled)
if (!controlsPlayer(Engine.GetPlayerID()) ||
!g_Players[Engine.GetPlayerID()].cheatsEnabled)
return false;
// Find the cheat code that is a prefix of the user input

View file

@ -402,7 +402,13 @@ function isPlayerObserver(playerID)
*/
function controlsPlayer(playerID)
{
return Engine.GetPlayerID() == playerID && !g_IsObserver || g_DevSettings.controlAll;
if (Engine.GetPlayerID() != playerID)
return false;
let playerState = GetSimState().players[playerID];
return playerState && (
playerState.state != "defeated" || playerState.controlsAll);
}
/**