ConstructionSite -> Structure
-
What is the best way to detect the transformation of Construction site into Structure?
I can only detect the moment when construction site disapears from the room and find the construction on the same place. Like this:var disappear = Game.getObjectById(constructionId) === undefined; var appear = position.lookFor('structure').length > 0; if (disappear && appear) { //it happened }
But I think this way isn't good. Any suggestions?
-
I have it the similar way like you:
constructionSite = Game.getObjectById(this.memory.target); if (!constructionSite){ // either structure was finished or construction site has been destroyed
Afaik, there is no other option at the moment to determine what happened with the construction site. It's the same thing with creating a construction site - you need to check the position for construction site instead of just getting the ID returned from the command. That has something to do with the tick based architecture and will hopefully be improved with the event stack hopefully introduced rather sooner than later.