HOW do i tranfer energy from a creep to all extensions
-
My problem is, is that it transfers it to only one extension
extension[0]
-
You need to find structures which need energy. Something like the code below.
structures = creep.room.find(FIND_MY_STRUCTURES, { filter: function (object) { return object.energy < object.energyCapacity;; } }); if (ERR_NOT_IN_RANGE === creep.transferEnergy(structures[0])) { creep.moveTo(structures[0]); }