Mendenbarr

RH

Sep 28th, 2015
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = function (creep) {
  2.     if (creep.memory.storageID == undefined) creep.memory.storageID = creep.room.storage.id;
  3.     if (creep.memory.load == false){
  4.         var mysource = Game.getObjectById(creep.memory.assignment);
  5.         if (!creep.pos.inRangeTo(mysource, 2)) creep.moveTo(mysource);
  6.         if (creep.carry.energy >= creep.carryCapacity) creep.memory.load = true;
  7.     }
  8.    
  9.     else {
  10.         var mystorage = Game.getObjectById(creep.memory.storageID);
  11.         creep.moveTo(mystorage);
  12.         creep.transferEnergy(mystorage);
  13.         if (creep.carry.energy == 0) creep.memory.load = false;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment