Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. var targets = creep.room.find(FIND_STRUCTURES, {
  2. filter: (structure) => {
  3. return (structure.structureType == STRUCTURE_EXTENSION ||
  4. structure.structureType == STRUCTURE_SPAWN ||
  5. structure.structureType == STRUCTURE_TOWER) && structure.energy < structure.energyCapacity;
  6. }
  7. });
  8. if(targets.length > 0) {
  9. //console.log("list isn't empty");
  10. if(creep.transfer(targets[0], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
  11. creep.moveTo(targets[0]);
  12. //console.log("if creep.move firing?");
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement