StructureContainer not inheriting Structure properties in ScreepsArena (Alpha)



  • Hello,

    I don't know if this is the correct forum to post this. I do not play Screeps but pre ordered ScreepsArena and I am currently following the tutorial. Although I a not completely stuck at step 5 (store and transfer), I was puzzled for some time because several properties of the StructureContainer object seem to be missing.

    Maybe I am just a newb missing something, but from the documentation I thought the 'StructureContainer' class would inherit properties from 'Structure' and 'OwnedStructure'. However, although it has the properties of an Object (id, x, y), it has no 'my', 'hits' or 'capacity' properties.

    Here is my code:

    import { prototypes, utils, constants } from '/game'; import { getRange } from '/game/utils';

    export function loop() {

    var myCreep = utils.getObjectsByPrototype(prototypes.Creep).find(creep => creep.my);
    var enemyCreep = utils.getObjectsByPrototype(prototypes.Creep).find(creep => !creep.my);
    
    var myTower = utils.getObjectsByPrototype(prototypes.StructureTower).find(tower => tower.my);
    var myContainer = utils.getObjectsByPrototype(prototypes.StructureContainer).find(container => true); 
    
    console.log('  myTower.my: ', myTower.my);
    console.log('  myTower.id: ', myTower.id);
    
    console.log('  myContainer.capacity :   ', myContainer.capacity);
    console.log('  myContainer.my: ', myContainer.my);
    console.log('  myContainer.hits :   ', myContainer.hits);
    
    console.log('  myContainer.id: ', myContainer.id);
    console.log('  myContainer.x: ', myContainer.x);
    console.log('  myContainer.y: ', myContainer.y);
    console.log('  myContainer.energy: ', myContainer.store[constants.RESOURCE_ENERGY]);
    
    myCreep.withdraw(myContainer, constants.RESOURCE_ENERGY);
    
    myCreep.transfer(myTower, constants.RESOURCE_ENERGY);
    
    myTower.attack(enemyCreep);
    
    console.log('  loop end :   ');
    

    }

    And here is my log: myTower.my: true myTower.id: 18 myContainer.capacity : undefined myContainer.my: undefined myContainer.hits : undefined myContainer.id: 22 myContainer.x: 50 myContainer.y: 50 myContainer.energy: 50 loop end :



  • This is mainly the forum for Screeps:World (The MMO/sandbox ver) currently alpha feedback/bugs have been posted on the Steam forums for the game: https://steamcommunity.com/app/1137320/discussions

    It shouldn't have a capacity, on the docs that's intended to show that it has a storage capacity of 2000, not that it has a property named capacity. All storage related things are done though .store https://steamcommunity.com/sharedfiles/filedetails/?id=2505541950

    To get a capacity code-wise you'd use getCapcity(RESOURCE_CONSTANT) off of store.

    Normally containers are considered neutral objects (though in Arena they seem to extend off an owned structure) so my should be false, and they as far as I know, should have hits.