-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
33 lines (29 loc) · 968 Bytes
/
main.js
File metadata and controls
33 lines (29 loc) · 968 Bytes
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
31
32
33
const profiler = require('screeps-profiler');
const Blueprint = require('./Blueprint');
profiler.enable();
for (const toImport of ["Room", "Source", "StructureSpawn", "Creep", "StructureLink", "StructureTower", "Store", "Structure"]) {
require("./" + toImport)();
}
for (const cat of ["sources", "creepsNames"]) {
Memory[cat] = Memory[cat] || new Object;
}
for (const room of Object.values(Game.rooms)) {
room.memory;
// room.scanExistingBuildings();
}
module.exports.loop = function () {
profiler.wrap(function () {
for (const roomName in Memory.rooms) {
const room = Game.rooms[roomName];
if (room == undefined) {
Memory.rooms[roomName] = undefined;
continue;
}
room.reactToTick();
}
for (const creep of Object.values(Game.creeps)) {
creep.doAction();
}
if (!Game.rooms.sim) Game.cpu.generatePixel();
});
}