Skip to content

Commit 35f2b20

Browse files
committed
bugfix: don't try to produce cliamer in a room that cannot.
1 parent 9c54aa9 commit 35f2b20

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/prototype_room_creepbuilder.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ Room.prototype.spawnCheckForCreate = function() {
106106
creep.ttl = creep.ttl || config.creep.queueTtl;
107107
if (this.findSpawnsNotSpawning().length === 0) {
108108
creep.ttl--;
109+
} else if (this.energyAvailable === this.energyCapacityAvailable) {
110+
creep.ttl = 0;
109111
}
110112
return false;
111113
};
@@ -543,7 +545,7 @@ Room.prototype.getCreepConfig = function(creep) {
543545
Room.prototype.spawnCreateCreep = function(creep) {
544546
const spawns = this.findSpawnsNotSpawning();
545547
if (spawns.length === 0) {
546-
return;
548+
return false;
547549
}
548550

549551
const config = this.getCreepConfig(creep);

0 commit comments

Comments
 (0)