22 lines
595 B
JavaScript
22 lines
595 B
JavaScript
var progressUtils = {
|
|
checkProgress : function() {
|
|
|
|
for(var roomName in Game.rooms){
|
|
const room = Game.rooms[roomName];
|
|
const structures = room.find(FIND_STRUCTURES);
|
|
room.memory.spawns = 0;
|
|
room.memory.containers = 0;
|
|
room.memory.extensions = 0;
|
|
|
|
for(const structure of structures){
|
|
if(structure.structureType == STRUCTURE_CONTAINER) room.memory.containers++;
|
|
if(structure.structureType == STRUCTURE_SPAWN) room.memory.spawns++;
|
|
|
|
if(structure.structureType == STRUCTURE_EXTENSION) room.memory.extensions++;
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = progressUtils;
|