screepCode/src/modules/util.ts

12 lines
441 B
TypeScript
Raw Normal View History

export function FindCapacity(creep: Creep) {
return creep.room.find(FIND_STRUCTURES, {
filter: (structure: StructureSpawn | StructureExtension) => {
let type = structure.structureType;
return (
(type == STRUCTURE_EXTENSION ||
type == STRUCTURE_SPAWN) &&
structure.store.getFreeCapacity(RESOURCE_ENERGY) as number > 0
)
}
})
}