12 lines
471 B
TypeScript
12 lines
471 B
TypeScript
|
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() != null && structure.store.getFreeCapacity() as number > 0
|
||
|
)
|
||
|
}
|
||
|
})
|
||
|
}
|