Room.findPath causing errors.



  • Getting the following error when trying to call RoomPosition.findPathTo:

    TypeError: Cannot read property 'undefined' of undefined
        at Grid.setWalkableAt (/opt/PathFinding.js/src/core/Grid.js:117:18)
        at Room.findPath (/opt/engine/dist/game/rooms.js:552:12)
        at RoomPosition.findPathTo (/opt/engine/dist/game/rooms.js:742:19)
        at Room.Game.extensions.AI.extensions.library.mayoAPI.Room.getCachedPath (main:4483:76)
        at Creep.Game.extensions.AI.extensions.library.mayoAPI.Creep.moveByCachedPath (main:4788:44)
        at goMine (main:5123:19)
        at Object.miningRoutine [as routine] (main:5039:17)
        at Creep.do (main:3069:25)
        at Object.turn (main:2184:17)
    

    Is this a server-side issue?



  • Seems the issue was on my end. I was feeding in a flag's .pos value, which was returning undefined for some reason : /

    Still trying to figure out why the flag's room position is returning undefined.



  • Flag.pos is undefined for the rooms you do not have presence in ( so that you can not spy on others with flags), however findPath to flag itself ( not it's position ) will work.



  • Huh. I knew that flag.room was undefined if you weren't there, but didn't realize pos was as well.

    This API-level fog of war probably has good reasoning behind it, but I wish it was more obvious in the docs.

    Anyway, thanks Dark.



  • As a rule of thumb: if it has findClosest method - it's not available 🙂