CONTAINER not found



  •  I can't seem to be able to find my containers with out just using the ids.

    I have tried _.filter(Game.structures,(i)=>i.structureType==STRUCTURE_CONTAINER) but that comes up empty as well as creep.room.find(FIND_STRUCTURES,(i)=>i.structureType==STRUCTURE_CONTAINER)

    it seems that when the containers are built they aren't added to the structure list.


  • Culture

    I can confirm that Game.structures doesn't contain your containers. It's probably because containers doesn't have an owner just like walls. If you do Game.structures['<id of a wall>'] it will come up as undefined as well.

    As of your second line of code it's incorrect. If you look at http://support.screeps.com/hc/en-us/articles/203079011-Room#find  you see that your function need to be passed with the filter attribute. like this:

    creep.room.find(FIND_STRUCTURES,{filter: (i)=> {return i.structureType==STRUCTURE_CONTAINER}})

     


  • Dev Team

    Containers are unowned structures, any player can use them, this is why they are not in the Game.structures hash which contains only your owned structures.



  • It just seems odd that containers are not owned.  Why is that?


  • Culture

    A good use of containers is storing energy in neutral rooms, and because you can build them anywhere it make sense to make them accessible by any player.