findClosest filter returning null
-
The following code is returning null:
var closestEmpty = creep.pos.findClosest(FIND_MY_STRUCTURES, {
filter: function(object){
console.log(object);
if(object.structureType != STRUCTURE_EXTENSION ) {
console.log("filtering non-extention");
return false;
}
if(object.energy == object.energyCapacity) {
console.log("filtering filled");
return false;
}
console.log("found empty");
return true;
}
});Then my move code is not running because I am finding no empty extentions:
creep.say("T->E");
console.log(closestEmpty);
creep.moveTo(closestEmpty);This is sample console output:
[7:23:39 PM][structure (rampart) #55ae31712d4d0cd2192fd806]
[7:23:39 PM]filtering non-extention
[7:23:39 PM][structure (rampart) #55ae33ad605d966466cc46da]
[7:23:39 PM]filtering non-extention
[7:23:39 PM][structure (rampart) #55ae34f9ef678ef07f9fb159]
[7:23:39 PM]filtering non-extention
[7:23:39 PM][structure (rampart) #55ae3ca69dd8fde17f2646b2]
[7:23:39 PM]filtering non-extention
[7:23:39 PM][structure (extension) #55ae8eca3fb1f94b7ef44675]
[7:23:39 PM]found empty
[7:23:39 PM][structure (extension) #55ae951130cf67df2ee4f12c]
[7:23:39 PM]found empty
[7:23:39 PM][structure (extension) #55ae97df319939ad194e601d]
[7:23:39 PM]found empty
[7:23:39 PM][structure (extension) #55ae9b6b319939ad194e61b8]
[7:23:39 PM]found empty
[7:23:39 PM][structure (rampart) #55aea0163fb1f94b7ef44dd3]
[7:23:39 PM]filtering non-extention
[7:23:47 PM]nullThis code worked as recently as 12:00 PDT today, but now seems to not be returning a found extension.
Anyone else having a similar issue?
-
Some copy paste issues made the timestamp look funny.. That is not the problem.. further relevant console log:
[7:30:31 PM][structure (extension) #55ae951130cf67df2ee4f12c]
[7:30:31 PM]found empty
[7:30:31 PM][structure (extension) #55ae97df319939ad194e601d]
[7:30:31 PM]found empty
[7:30:31 PM][structure (extension) #55ae9b6b319939ad194e61b8]
[7:30:31 PM]found empty
[7:30:31 PM][structure (rampart) #55aea0163fb1f94b7ef44dd3]
[7:30:31 PM]filtering non-extention
[7:30:31 PM]null
-
Does it work if you replace findClosest with findClosestByRange ?
-
Thanks for reporting, this must be fixed now.
-
Thanks, definitely fixed!