更大的收集者收集逻辑, Container获取逻辑

This commit is contained in:
jie
2024-11-04 00:02:42 +08:00
parent 182e672086
commit 57277eff2d
6 changed files with 41 additions and 17 deletions

View File

@@ -4,7 +4,8 @@ export function FindCapacity(creep: Creep): AnyStructure[] {
let type = structure.structureType;
return (
(type == STRUCTURE_EXTENSION ||
type == STRUCTURE_SPAWN) &&
type == STRUCTURE_SPAWN||
type == STRUCTURE_CONTAINER) &&
structure.store.getFreeCapacity(RESOURCE_ENERGY) as number > 0
)
}
@@ -22,4 +23,15 @@ export function GetConstructureSet(creep: Creep, structureType: string | null =
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
}