2024-11-03 22:04:05 +08:00
|
|
|
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) &&
|
2024-11-03 22:17:23 +08:00
|
|
|
structure.store.getFreeCapacity(RESOURCE_ENERGY) as number > 0
|
2024-11-03 22:04:05 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|