21 lines
591 B
JavaScript
21 lines
591 B
JavaScript
var progressUtils = {
|
|
checkProgress : function() {
|
|
|
|
for(var room in Game.rooms){
|
|
const structures = Game.rooms[room].find(FIND_MY_STRUCTURES);
|
|
room.memory.hasContainer = false;
|
|
room.memory.hasSpawn = false;
|
|
room.memory.extensions = 0;
|
|
|
|
for(var structure in structures){
|
|
if(structure.structureType == STRUCTURE_CONTAINER) room.memory.hasContainer = true;
|
|
if(structure.structureType == STRUCTURE_SPAWN) room.memory.hasSpawn = true;
|
|
|
|
if(structure.structureType == STRUCTURE_EXTENSION) room.memory.extensions++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = progressUtils;
|