C.Walls and Roads are missing from Game.structures

I’m not sure that I am missing something, but the roads and built walls do not appear in Game.structures, while the shafts and extensions look great. Is this a mistake, or am I doing something wrong. Here is the code I'm using

for(var i in Game.structures){
 var struct = Game.structures[i];    
 var type =  struct.structureType;
 console.log(type);

}

+4
source share
2 answers

According to the documentation. Game.structurescontains your structure. Walls and roads do not belong to any user, so they are not there.

+5
source
Yes, that also confused me. As the developer noted, roads and walls are not inherently “yours” (or any elses), so they are not on the lists where you usually find your structures.

, :

var allRoadsAndWalls = creep.room.find(Game.STRUCTURES, {filter:function(structure) {
    return structure.structureType == "road" || structure.structureType == "constructedWall";
}});
+4

All Articles