Yilmas / hCoreAI

Screeps AI
2 stars 3 forks source link

If Mine has no creeps, Game.getObjectById causes error, specifically "Cannot read property 'room' of null" #1

Closed Yilmas closed 7 years ago

Yilmas commented 7 years ago

brain.special.roleManager.js at line 49

Perhaps we could fix this, by giving the creep a memory.homeRoom, so it can always find the room, after which Game.getObjectById() will be able to pickup the corresponding object. I'm thinking this error, will not be addressed until we create the new memory module

Yilmas commented 7 years ago

The fix from 08f01c1 did not work, and the code continues to break apart if no creeps is in the room. Hopefully, we can solve this entirely, when we move to the new memory script.

Yilmas commented 7 years ago

This problem must be fixed ASAP, as it is causing hard resets of the entire script every day...

Yilmas commented 7 years ago

Noticed that this error seems to occur only with prospectors, and only through their endPoint being set to a source, which is used in its behaviour. And, the startPoint is never used, I believe that is a remnant of some old code... startPoint will be set as a RoomPosition in the target room, and will be used to change room, instead of the endPoint. This should hopefully fix the error.