export function FindCapacity(creep: Creep): AnyStructure[] { return creep.room.find(FIND_STRUCTURES, { filter: (structure: StructureSpawn | StructureExtension) => { let type = structure.structureType; return ( (type == STRUCTURE_EXTENSION || type == STRUCTURE_SPAWN|| type == STRUCTURE_CONTAINER) && structure.store.getFreeCapacity(RESOURCE_ENERGY) as number > 0 ) } }) } export function GetSource(sourceId: Id | null): Source { return Game.getObjectById(sourceId); } export function GetConstructureSet(creep: Creep, structureType: string | null = null): ConstructionSite[] { return creep.room.find(FIND_CONSTRUCTION_SITES, { filter: (structure: Structure) => { if (structureType == null) return true; return structure.structureType == structureType; } }) } export function GetConstructure(creep: Creep, structureType: string, ){ return creep.room.find(FIND_STRUCTURES, {filter:(structure: AnyStructure)=>{ return structure.structureType == structureType; }}) } export function GetContainer(creep: Creep): StructureContainer[]{ let target = GetConstructure(creep, STRUCTURE_CONTAINER) as StructureContainer[]; return target }