findClosest returning RoomPosition objects?
-
I'm passing creep and structure objects to
RoomPosition.prototype.findClosest
and the recent update seems to return RoomPosition objects of these objects.I'm pretty sure this is a mistake
-
Code to reproduce:
var creeps = []; for (var i in Game.creeps) { creeps.push(Game.creeps[i]) } Game.spawns.Spawn1.pos.findClosest(creeps) instanceof Creep;
-
Also try
Game.spawns.Spawn1.pos.findClosest(creeps) instanceof RoomPosition;
This shouldn't be true
-
Same for me - my whole code breaks and returns
ERR_INVALID_TARGET
.
-
I am having the same issue.
-
same here.
-
Aw man, code broke 3h ago because of this. Are we expected to start using
.lookForAt
calls or something?
-
@GrandonBroseph There can be many objects on the same place though...
-
Also note that using
findClosest
with a FIND_ constant isn't affected by this bug
-
I don't think that will be the case. I think this is a bug that I am sure will be fixed shortly.
-
Thanks for reporting, fixed.
-
@avdg_: Yeah, I figured that out lol. I just used
.lookAt
if it returned apos
value, but as the bug is fixed it's no big deal.
-
@Artem, Thanks! Everything is working great now!