-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathreport.buildings.js
30 lines (24 loc) · 1.08 KB
/
report.buildings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const ignoredStructures = ["rampart", "constructedWall", "road", "container", "powerSpawn", "factory"];
const expectationOverrides = {
link: (r) => r.find(FIND_SOURCES).length + 2
}
class BuildingsReport {
report() {
for(let room of _.filter(Game.rooms, (r) => r.ai())) {
console.log(`---- Report for ${room.name} ----`)
let structures = _.groupBy(room.find(FIND_MY_STRUCTURES), (s) => s.structureType);
for(let structureType in CONTROLLER_STRUCTURES) {
if(ignoredStructures.includes(structureType)) continue;
let expected = CONTROLLER_STRUCTURES[structureType][room.controller.level];
if(expectationOverrides[structureType]) {
expected = expectationOverrides[structureType](room);
}
let actual = (structures[structureType] || []).length;
if(actual < expected) {
console.log(`${actual} / ${expected} ${structureType}`)
}
}
}
}
}
module.exports = new BuildingsReport();