Fixed builder and guard

This commit is contained in:
ObeseTermite 2025-06-04 18:01:07 -07:00
parent 4b403bb935
commit e6d90d43a4
2 changed files with 3 additions and 5 deletions

View file

@ -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;

View file

@ -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{