When trying to look at a flag (although it happens with any pos.look()) in a room without any creeps or builds which generate a room object will not work, I know this.
However, I have a room that has 4 creeps in it (two reserving the controller, 2 defenders looking for hostiles). The room is in the Game.rooms object. The creeps all return a valid room and roomposition object, as does the flag. But anytime I try to do a look or lookFor on any of them, I get:
TypeError: Cannot read property 'lookTypeSpatialRegisters' of undefined
at .lookAt (evalmachine.<anonymous>:1:72)
at .look (evalmachine.<anonymous>:1:72)
at Object.run (spotminer:52:62)
at Object.module.exports.loop (main:55:23)
at __mainLoop:1:52
It seems to happen on the 3rd room I am working with. The spawn room works fine. The first room I try remote operations in works fine. The second I place a flag in the 3rd room my code starts throwing that.
What am I doing wrong?