Screeps Wiki
Advertisement

function (target) {

   if (!this.my) {
     return C.ERR_NOT_OWNER;
   }
   if (data(this.id).spawning) {
     return C.ERR_BUSY;
   }
   if (!target || !target.id || !register.energy[target.id] || !(target instanceof globals.Energy)) {
     return C.ERR_INVALID_TARGET;
   }
   if (this.energy >= this.energyCapacity) {
     return C.ERR_FULL;
   }
   if (!target.pos.isNearTo(this.pos)) {
     return C.ERR_NOT_IN_RANGE;
   }
   intents[this.id] = intents[this.id] || {};
   intents[this.id].pickup = {id: target.id};
   return C.OK;
 }

Advertisement