findPathToClosest()
-
I find myself sometimes using findClosest() followed by some method to generate a path to the result. Since findClosest() appears to be using Dijkstra, could we get a variant that returns the path instead of the target?
-
Not having the target might be problematical as well, doesn't it? Instead, one could as well return an object containing the object AND the path. You could for example create your own prototype method:
Creep.prototype.findMyClosest = function findMyClosest(args){ var target = this.findClosest(args); return {target:target,path:this.pos.findPathTo(target)}; }