diff --git a/role_builder.js b/role_builder.js index cc8e965..961a045 100644 --- a/role_builder.js +++ b/role_builder.js @@ -3,10 +3,8 @@ var roleBase = require('role_base'); class roleBuilder extends roleBase{ /** @param {Creep} creep **/ - constructor(){ - super() - this.name = 'builder'; - } + static name = 'builder'; + static run(creep) { if(creep.memory.building && creep.store[RESOURCE_ENERGY] == 0) { creep.memory.building = false; diff --git a/role_guard.js b/role_guard.js index 8cf224c..f8ee11f 100644 --- a/role_guard.js +++ b/role_guard.js @@ -13,7 +13,7 @@ class roleGuard extends roleBase{ } else { var currentWaypoint = Game.flags[creep.memory.waypoints[creep.memory.currentWaypoint]]; - if(getRangeTo(currentWaypoint) > 0){ + if(creep.pos.getRangeTo(currentWaypoint) > 0){ creep.moveTo(currentWaypoint); } else{