Screeps Wiki
Advertisement

function (target) {

   if (!this.my) {
     return C.ERR_NOT_OWNER;
   }
   if (data(this.id).spawning) {
     return C.ERR_BUSY;
   }
   if (this.getActiveBodyparts(C.HEAL) == 0) {
     return C.ERR_NO_BODYPART;
   }
   if (!target || !target.id || !register.creeps[target.id] || !(target instanceof globals.Creep)) {
     return C.ERR_INVALID_TARGET;
   }
   if (Math.abs(target.pos.x - this.pos.x) > 3 || Math.abs(target.pos.y - this.pos.y) > 3) {
     return C.ERR_NOT_IN_RANGE;
   }
   intents[this.id] = intents[this.id] || {};
   intents[this.id].rangedHeal = {id: target.id};
   return C.OK;
 }

Advertisement