mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
Continue to allow cheating and some other commands after winning the game. Refs #3168.
This was SVN commit r18346.
This commit is contained in:
parent
fab2e9274a
commit
4bb9c80001
2 changed files with 9 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue