From a056bf73184b65c0504c7d16c0a63564c0e3861b Mon Sep 17 00:00:00 2001 From: XenoAmess Date: Sat, 24 Sep 2022 19:45:04 +0800 Subject: [PATCH] bugfix: don't try to produce cliamer in a room that cannot. --- src/prototype_room_creepbuilder.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/prototype_room_creepbuilder.js b/src/prototype_room_creepbuilder.js index 7bbb2a526..c87ae165e 100644 --- a/src/prototype_room_creepbuilder.js +++ b/src/prototype_room_creepbuilder.js @@ -54,6 +54,8 @@ Room.prototype.spawnCheckForCreate = function() { creep.ttl = creep.ttl || config.creep.queueTtl; if (this.findSpawnsNotSpawning().length === 0) { creep.ttl--; + } else if (this.energyAvailable === this.energyCapacityAvailable) { + creep.ttl = 0; } return false; }; @@ -473,7 +475,7 @@ Room.prototype.getCreepConfig = function(creep) { Room.prototype.spawnCreateCreep = function(creep) { const spawns = this.findSpawnsNotSpawning(); if (spawns.length === 0) { - return; + return false; } const config = this.getCreepConfig(creep);