-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconstruction.booster.js
26 lines (24 loc) · 974 Bytes
/
construction.booster.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
module.exports = {
outline: function(room, booster) {
let x = booster.x,
y = booster.y;
room.visual.circle(x, y, { stroke: "#77f", radius: 0.5, fill: null });
},
build: function(proxy, booster, roomai) {
proxy.planConstruction(booster.x, booster.y, STRUCTURE_LAB);
let lab = _.find(roomai.labs.all, (l) => l.pos.x === booster.x && l.pos.y === booster.y);
if(lab) roomai.labs.setBooster(lab);
},
updateCostMatrix: function(matrix, booster) {
matrix.set(booster.x, booster.y, 255);
},
addBuilding: function(memory, flag) {
memory.push({ x: flag.pos.x, y: flag.pos.y });
},
removeBuilding: function(memory, flag) {
let index = _.findIndex(memory, (p) => p.x == flag.pos.x && p.y == flag.pos.y);
if(index >= 0) memory.splice(index, 1);
}
};
const profiler = require("screeps-profiler");
profiler.registerObject(module.exports, 'construction.booster');