-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.js
28 lines (25 loc) · 944 Bytes
/
logger.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
/**
* Logging functionality
*/
var _ = require('lodash');
let utils = require('utils');
let roles = require('roles');
const log = {
roomEnergy: (room, tickInterval) => {
if (Game.time % tickInterval === 0) {
let eAvail = room.energyAvailable, eCap = room.energyCapacityAvailable;
const droppedEnergy = room.find(FIND_DROPPED_RESOURCES);
utils.cLC(`E: ${eAvail}, cap: ${eCap}, %: ${ ((eAvail/eCap) * 100).toFixed(2) } - dropped: ${_.size(droppedEnergy)}`);
}
},
roleCount: (room, tickInterval) => {
if (Game.time % tickInterval === 0) {
//ToDO: loop through all the roles in the role main file
let harvCount = utils.countRole( 'harvester' );
let upgraderCount = utils.countRole( 'upgrader' );
let builderCount = utils.countRole( 'builder' );
utils.cLC(`Harvs: ${harvCount}, Ups: ${upgraderCount}, Builds: ${ builderCount }, Construction: ${_.size(Game.constructionSites)}`);
}
}
};
module.exports = log;