Screeps Wiki
Advertisement


function (amount) {

   if (!this.my) {
     return C.ERR_NOT_OWNER;
   }
   if (data(this.id).spawning) {
     return C.ERR_BUSY;
   }
   if (!data(this.id).energy) {
     return C.ERR_NOT_ENOUGH_ENERGY;
   }
   if (!amount) {
     amount = data(this.id).energy;
   }
   if (this.energy < amount) {
     return C.ERR_NOT_ENOUGH_ENERGY;
   }
   intents[this.id] = intents[this.id] || {};
   intents[this.id].dropEnergy = {amount: amount};
   return C.OK;
 }

Advertisement