-
Notifications
You must be signed in to change notification settings - Fork 0
/
pr.rooms.spawn.js
76 lines (56 loc) · 1.83 KB
/
pr.rooms.spawn.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Module code goes here. Use 'module.exports' to export things:
* module.exports.thing = 'a thing';
*
* You can import it from another modules like this:
* var mod = require('pr.rooms.spawn');
* mod.thing == 'a thing'; // true
*/
var logger = require("screeps.logger");
logger = new logger("pr.rooms.spawn");
//logger.enabled = false;
let baseRoom = require("pr.rooms.base");
class spawnRoomProc extends baseRoom {
init() {
super.init();
}
run() {
super.run();
this.setupBasicProcs();
this.setupCreeps();
//_.each(this.workers, (c) => logger.log("------====",c, c.suicide()));
let intel = this.intel.getRoomIntel(this.data.roomName);
//logger.log((_.size(this.workers) + _.size(this.builders)), JSON.stringify(this.workers))
// for(let i in this.workers) {
// logger.log(i)
// }
let workerProc = this.kernel.getProcess("workers-"+this.data.roomName);
if (workerProc && workerProc.creeps.length == 0) {
//set emergency mode in intel
intel.emergencyMode = true;
} else {
intel.emergencyMode = false;
}
}
setupBasicProcs() {
this.setupSpawns();
this.setupTowers();
this.setupPiles();
this.setupContainers();
this.setupSources();
}
setupCreeps() {
this.setupMiners();
this.setupWorkers();
this.setupFillers();
this.setupBuilders();
this.setupUpgraders();
this.setupTransporters();
//this.makeWorkers(1);
// this.makeFillers(1);
// this.makeBuilders(1);
// this.makeUpgraders(3);
// this.makeTransporters(2);
}
}
module.exports = spawnRoomProc;