Ticket #3545: 3545.diff

File 3545.diff, 1.0 KB (added by Stan, 9 years ago)

This patch limits the number of batch cheat spawnable units to 500 add a comment, and document a bit the cheat function.

  • binaries/data/mods/public/simulation/helpers/Cheat.js

     
     1/**
     2 * This function uses the cheat data input to perform different actions such as adding resources, spawning units
     3 * modifying max population etc.
     4 */
    15function Cheat(input)
    26{
    37    var cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);
     
    7276            cmpGuiInterface.PushNotification({"type": "notification", "players": [input.player], "message": "You need to select a building that trains units."});
    7377            return;
    7478        }
     79    // We want to prevent spawning too many units at once cause it might crash the game.
     80    if (input.parameter > 500)
     81      return;
     82   
    7583        for (let i = 0; i < input.parameter; ++i)
    7684            cmpProductionQueue.SpawnUnits(input.templates[i % input.templates.length], 1, null);
    7785        break;