-
Notifications
You must be signed in to change notification settings - Fork 0
/
displayer.js
79 lines (61 loc) · 2.53 KB
/
displayer.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
77
78
79
var mgr = require("mgr");
var marketMgr = require("mgr.market");
var displayer = {
displayAll: function () {
console.log('----------------------------------------------');
console.log(Game.cpu.bucket + "/10000 new pixel");
if (Game.cpu.bucket > 10000) {
console.log(Game.cpu.generatePixel());
}
// mgr.updateCreepMem("outside");
console.log("Outside Creeps: " + Memory.outside.creeps.total)
var outsideInfo = ""
for (var role in Memory.outside.creeps) {
if (role != "total") {
outsideInfo += role + ": " + Memory.outside.creeps[role] + "|"
}
}
//for each room owned
for (let roomName in Game.rooms) {
let room = Game.rooms[roomName];
if (room.controller && room.controller.my) {
roomLevel = "Level: " + room.controller.level;
if (room.controller.level === 8) {
roomLevel = "Level: MAX";
}
//Game.time
var header = roomName + "- Energy: " + room.energyAvailable + " Creeps: " + Memory[roomName].creeps.total + " " + roomLevel + "\n"
//console.log(room.energyAvailable + " in " + roomName + " at " + Game.time + " with " + Memory[roomName].creeps["Total"] + "/20 creeps");
var roomInfo = "";
for (var role in Memory[roomName].creeps) {
if (role != "total") {
roomInfo += role + ": " + Memory[roomName].creeps[role] + " | ";
}
}
console.log(header + roomInfo)
//market
marketMgr.manageRoomRes(room);
}
}
console.log("----------------------------------------------")
},
spawning: function (room) {
//display when a new screep is spawning
var roomName = room.name;
for (var i in Memory[roomName].spawns) {
var spawn = Game.spawns[Memory[roomName].spawns[i].name]
// console.log("spawn " + spawn)
if (spawn.spawning) {
var creep = Game.creeps[spawn.spawning.name]
//console.log("spawning creep " + creep)
spawn.room.visual.text(
'🛠️' + creep.memory.role,
spawn.pos.x + 1,
spawn.pos.y,
{ align: 'left', opacity: .8 }
)
}
}
}
}
module.exports = displayer;