module.exports = {
  run: function(creep) {
    if (_.sum(creep.carry) == creep.carryCapacity) {
      var storages = creep.room.find(FIND_MY_STRUCTURES, {
        filter: i => i.energy < i.energyCapacity
      });
      var target = storages[0];
      target = target || Game.spawns['Spawn1'];
      if (creep.transfer(target, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
        creep.moveTo(target);
      }
    } else {
      var target = creep.pos.findClosestByRange(FIND_DROPPED_ENERGY);
      if(target) {
        if(creep.pickup(target) == ERR_NOT_IN_RANGE) {
          creep.moveTo(target);
        }
      }
    }
  },
  bodyparts: [MOVE, MOVE, CARRY, CARRY]
};

@@ -208,16 +208,291 @@
     %7D);%0A
+      storages.sort(function(a,b) %7B%0A        var ast = a.structureType;%0A        var bst = b.structureType;%0A        if (ast == bst)%0A          return 0;%0A        if (ast == STRUCTURE_TOWER) // Give towers first priority on energy%0A          return -1;%0A        return 1;%0A      %7D);%0A
       va
@@ -544,29 +544,26 @@
  %7C%7C 
-Game.spawns%5B'Spawn1'%5D
+creep.room.storage
 ;%0A  

add some prioritization to energy distribution