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 :