And what must i do?
TelEGraffoNy
@TelEGraffoNy
2
Posts
996
Profile views
0
Followers
0
Following
Posts made by TelEGraffoNy
-
SOS!!!
Why donot in work?: var roleMule = { run: function(creep) {
if(creep.memory.mule && creep.store[RESOURCE_ENERGY] == 0) { creep.memory.muleing = false; } if(!creep.memory.mule && creep.store.getFreeCapacity() == 0) { creep.memory.muleing = true; } var targets = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.structureType == STRUCTURE_EXTENSION || structure.structureType == STRUCTURE_SPAWN || structure.structureType == STRUCTURE_TOWER) && structure.store.getFreeCapacity() > 0; } }); var containers = creep.room.find(STRUCTURE_CONTAINER, { filter: (structure) => { return (structure.structureType == STRUCTURE_CONTAINER) && (structure.store[RESOURCE_ENERGY] > 0); } }); if(creep.memory.muleing) { if(targets.length > 0) { if(creep.transfer(targets[0], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) { creep.moveTo(targets[0]); } } } else { if(containers.length > 0) { if(creep.withdraw(containers[0], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) { creep.moveTo(containers[0]); } } } }
};
module.exports = roleMule;