RoomPosition.findClosestByPath() error



  • I am getting an error in my function only since an update:

    The function is:
    Creep.prototype.goNear = function(dist, opts) {
    dist =_.isNumber(dist) ? dist : 0;
    targs = this.target.pos.getNear(dist);
    this.log(targs + ' ' + opts)
    var goal = this.pos.findClosestByPath(targs);
    //this.log(goal)
    return this.moveTo(goal, opts)
    }

    The arguments given are:
    dist = [room E11N4 pos 35,-1],[room E11N4 pos 35,0],[room E11N4 pos 35,1],[room E11N4 pos 35,2],[room E11N4 pos 35,3],[room E11N4 pos 35,4],[room E11N4 pos 35,5],[room E11N4 pos 36,-1],[room E11N4 pos 36,0],[room E11N4 pos 36,1],[room E11N4 pos 36,2],[room E11N4 pos 36,3],[room E11N4 pos 36,4],[room E11N4 pos 36,5],[room E11N4 pos 37,-1],[room E11N4 pos 37,0],[room E11N4 pos 37,1],[room E11N4 pos 37,2],[room E11N4 pos 37,3],[room E11N4 pos 37,4],[room E11N4 pos 37,5],[room E11N4 pos 38,-1],[room E11N4 pos 38,0],[room E11N4 pos 38,1],[room E11N4 pos 38,2],[room E11N4 pos 38,3],[room E11N4 pos 38,4],[room E11N4 pos 38,5],[room E11N4 pos 39,-1],[room E11N4 pos 39,0],[room E11N4 pos 39,1],[room E11N4 pos 39,2],[room E11N4 pos 39,3],[room E11N4 pos 39,4],[room E11N4 pos 39,5],[room E11N4 pos 40,-1],[room E11N4 pos 40,0],[room E11N4 pos 40,1],[room E11N4 pos 40,2],[room E11N4 pos 40,3],[room E11N4 pos 40,4],[room E11N4 pos 40,5],[room E11N4 pos 41,-1],[room E11N4 pos 41,0],[room E11N4 pos 41,1],[room E11N4 pos 41,2],[room E11N4 pos 41,3],[room E11N4 pos 41,4],[room E11N4 pos 41,5]
    opts = undefined

    Here is the error message:
    [3:29:24 PM]TypeError: Cannot set property '35' of undefined
    at arrayEach (/opt/engine/node_modules/lodash/index.js:1289:13)
    at Function.<anonymous> (/opt/engine/node_modules/lodash/index.js:3345:13)
    at Creep.goNear (creep:626:25)
    at Creep.tick (creep:298:15)

    Line 'at Creep.goNear (creep:626:25)' is 'var goal = this.pos.findClosestByPath(targs);' which is an API function

    If you can fix this that would be great

    Thanks