store.getCapacity() is null on empty stores



  • Which shard is affected? 2

    What happened?

    using .getCapacity() without a parameter on an empty store returns null instead of the capacity of the store. however it seems like using .getCapacity(RESOURCE_ENERGY) for example returns the correct and expected value.

    What should have happened?

    .getCapacity() should always return the stores capacity

    How can we reproduce this?

    example by @JINPEI from slack:

    Game.rooms['E2N26'].find(FIND_STRUCTURES,{filter:(st)=>(st.store && st.store[RESOURCE_ENERGY]==0)})[0].store.getCapacity(); // and it returns null

    Game.rooms['E2N26'].find(FIND_STRUCTURES,{filter:(st)=>(st.store && st.store[RESOURCE_ENERGY]>0)})[0].store.getCapacity(); // returns 2000 (suppose a container)


  • Dev Team

    Could you please provide the structure ID?



  • the sample isnt mine so i cant sadly, however i noticed this behavior on all my spawns/extensions if that helps?


  • Dev Team

    This is intended behavior for spawns and extensions. They are not general-purpose stores, so getCapacity without the param returns null.