-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
37 lines (27 loc) · 1.12 KB
/
main.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
//import
var roleHarvester = require('./role.harvester');
var roleUpgrader = require('./role.upgrader');
var roleBuilder = require('./role.builder');
var managementModule = require('./management');
var defenseModule = require('./defense');
var constants = require('./constants');
var _ = require("lodash");
module.exports.loop = function () {
managementModule.cleanmemories();
defenseModule.manage();
var harvesters = _.filter(Game.creeps, (creep) => creep.memory.role == constants.ROLE_HARVESTER);
var builders = _.filter(Game.creeps, (creep) => creep.memory.role == constants.ROLE_BUILDER);
var upgraders = _.filter(Game.creeps, (creep) => creep.memory.role == constants.ROLE_UPGRADER);
console.log('Harvesters: ' + harvesters.length + ' - Builders: ' + builders.length + ' - Upgraders: ' + upgraders.length);
if(harvesters.length < 2) {
roleHarvester.create();
}
if(builders.length < 1) {
roleBuilder.create();
}
if(upgraders.length < 1) {
roleUpgrader.create();
}
managementModule.showSpawningMessage();
managementModule.executeCreepProcess();
}