Index: binaries/data/mods/public/simulation/components/Trainer.js =================================================================== --- binaries/data/mods/public/simulation/components/Trainer.js +++ binaries/data/mods/public/simulation/components/Trainer.js @@ -199,6 +199,11 @@ this.finished = true; }; +Trainer.prototype.Item.prototype.IsFinished = function() +{ + return !!this.finished; +}; + /* * This function creates the entities and places them in world if possible * (some of these entities may be garrisoned directly if autogarrison, the others are spawned). @@ -682,7 +687,7 @@ { const item = this.queue.get(id); const usedTime = item.Progress(allocatedTime); - if (item.finished) + if (item.IsFinished()) this.queue.delete(id); return usedTime; }; Index: binaries/data/mods/public/simulation/helpers/Cheat.js =================================================================== --- binaries/data/mods/public/simulation/helpers/Cheat.js +++ binaries/data/mods/public/simulation/helpers/Cheat.js @@ -83,7 +83,8 @@ const batch = new cmpTrainer.Item(input.templates[i % input.templates.length], 1, input.selected[0], null); batch.player = owner; batch.Finish(); - // ToDo: If not able to spawn, cancel the batch. + if (!batch.IsFinished()) + batch.Stop(); } return; }