Fixed builder and guard
This commit is contained in:
parent
4b403bb935
commit
e6d90d43a4
|
@ -3,10 +3,8 @@ var roleBase = require('role_base');
|
||||||
|
|
||||||
class roleBuilder extends roleBase{
|
class roleBuilder extends roleBase{
|
||||||
/** @param {Creep} creep **/
|
/** @param {Creep} creep **/
|
||||||
constructor(){
|
static name = 'builder';
|
||||||
super()
|
|
||||||
this.name = 'builder';
|
|
||||||
}
|
|
||||||
static run(creep) {
|
static run(creep) {
|
||||||
if(creep.memory.building && creep.store[RESOURCE_ENERGY] == 0) {
|
if(creep.memory.building && creep.store[RESOURCE_ENERGY] == 0) {
|
||||||
creep.memory.building = false;
|
creep.memory.building = false;
|
||||||
|
|
|
@ -13,7 +13,7 @@ class roleGuard extends roleBase{
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var currentWaypoint = Game.flags[creep.memory.waypoints[creep.memory.currentWaypoint]];
|
var currentWaypoint = Game.flags[creep.memory.waypoints[creep.memory.currentWaypoint]];
|
||||||
if(getRangeTo(currentWaypoint) > 0){
|
if(creep.pos.getRangeTo(currentWaypoint) > 0){
|
||||||
creep.moveTo(currentWaypoint);
|
creep.moveTo(currentWaypoint);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
Loading…
Reference in a new issue