更大的收集者收集逻辑, Container获取逻辑
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user