summaryrefslogtreecommitdiff
path: root/src/role.builder.js
diff options
context:
space:
mode:
authorTom Harley2018-06-26 16:21:46 +0100
committerTom Harley2018-06-26 16:21:46 +0100
commit19d3d7dbae37c5d863f8887602ef8241ac770551 (patch)
tree1b1e63d378e6e0f719c41cc272b7bad23f10d6c1 /src/role.builder.js
parentUnify movement commands (diff)
downloadscreeps-ai-19d3d7dbae37c5d863f8887602ef8241ac770551.tar.gz
screeps-ai-19d3d7dbae37c5d863f8887602ef8241ac770551.zip

Actually include unified movement function

Diffstat (limited to 'src/role.builder.js')
-rw-r--r--src/role.builder.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/role.builder.js b/src/role.builder.js
index a4fc27f..8c7fc6b 100644
--- a/src/role.builder.js
+++ b/src/role.builder.js
@@ -1,3 +1,5 @@
+const util = require('creep');
+
module.exports = {
run: (creep) => {
if (creep.memory.state === "building") {
@@ -5,7 +7,7 @@ module.exports = {
const targets = creep.room.find(FIND_CONSTRUCTION_SITES);
if (targets.length) {
if (creep.build(targets[0]) == ERR_NOT_IN_RANGE) {
- move(creep, targets[0]);
+ util.move(creep, targets[0]);
}
}
} else {
@@ -16,7 +18,7 @@ module.exports = {
// still filling up
const spawn = Game.spawns['Initial'];
if (creep.transfer(spawn, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
- move(creep, spawn);
+ util.move(creep, spawn);
}
} else {
creep.memory.state = "building";