mirror of
https://github.com/paradizelost/screeps.git
synced 2024-11-25 02:14:44 -06:00
Fixed edge case in logic that caused creeps to just sit there
This commit is contained in:
parent
e8e8d8a138
commit
9cd8f77f36
@ -11,14 +11,14 @@ var roleHauler = {
|
|||||||
}
|
}
|
||||||
var sources = creep.room.find(FIND_DROPPED_ENERGY );
|
var sources = creep.room.find(FIND_DROPPED_ENERGY );
|
||||||
if(creep.memory.hauling==false){
|
if(creep.memory.hauling==false){
|
||||||
if(creep.pickup(sources[0]) == ERR_NOT_IN_RANGE && creep.carryCapacity/2 > creep.carry.energy) {
|
if(creep.pickup(sources[0]) == ERR_NOT_IN_RANGE && creep.carryCapacity > creep.carry.energy) {
|
||||||
creep.moveTo(sources[0]);
|
creep.moveTo(sources[0]);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(sources != undefined )
|
if(sources != undefined )
|
||||||
{ var spawntargets = creep.room.find(FIND_STRUCTURES, {
|
{ var spawntargets = creep.room.find(FIND_STRUCTURES, {
|
||||||
filter: (structure) => {
|
filter: (structure) => {
|
||||||
return ((structure.structureType == STRUCTURE_EXTENSION || structure.structureType == STRUCTURE_SPAWN) &&structure.energy < structure.energyCapacity)
|
return ((structure.structureType == STRUCTURE_EXTENSION || structure.structureType == STRUCTURE_SPAWN) && structure.energy < structure.energyCapacity)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var containertargets = creep.room.find(FIND_STRUCTURES, {
|
var containertargets = creep.room.find(FIND_STRUCTURES, {
|
||||||
|
Loading…
Reference in New Issue
Block a user