diff --git a/src/Workers/Constructor.ts b/src/Workers/Constructor.ts index 548283b..bdb568f 100644 --- a/src/Workers/Constructor.ts +++ b/src/Workers/Constructor.ts @@ -6,7 +6,7 @@ import { withdrawEnergy } from "../Actions/withdrawEnergy"; import { WorkerDefinition } from "./worker"; export const Constructor: WorkerDefinition = { - runAction: (creep: Creep) => runAction(creep, withdrawEnergy( creep.pos.findClosestByRange(FIND_STRUCTURES, { filter: { structureType: STRUCTURE_CONTAINER }}))) + runAction: (creep: Creep) => runAction(creep, withdrawEnergy(creep.pos.findClosestByRange(FIND_STRUCTURES, { filter: { structureType: STRUCTURE_CONTAINER }}) as StructureContainer | null)) .or(harvestFromClosestActiveSource()) .andThen(buildConstructionSite()) .or(creep.room.controller ? upgradeController(creep.room.controller) : Fail) diff --git a/src/Workers/Miner.ts b/src/Workers/Miner.ts index b8298d2..b49d71b 100644 --- a/src/Workers/Miner.ts +++ b/src/Workers/Miner.ts @@ -5,7 +5,7 @@ import { WorkerDefinition } from "./worker"; export const Miner: WorkerDefinition = { runAction: (creep: Creep) => runAction(creep, harvestFromClosestActiveSource()) - .andThen(transferEnergy( creep.pos.findClosestByRange(FIND_STRUCTURES, { filter: { structureType: STRUCTURE_CONTAINER }}))) + .andThen(transferEnergy(creep.pos.findClosestByRange(FIND_STRUCTURES, { filter: { structureType: STRUCTURE_CONTAINER }}) as StructureContainer | null)) .repeat(), name: 'miner', requiredCreeps: (room: Room) => room.find(FIND_STRUCTURES, { filter: { structureType: STRUCTURE_CONTAINER }}).length > 0 ? 4 : 0, diff --git a/src/Workers/Upgrader.ts b/src/Workers/Upgrader.ts index b721318..42791f0 100644 --- a/src/Workers/Upgrader.ts +++ b/src/Workers/Upgrader.ts @@ -6,10 +6,10 @@ import { withdrawEnergy } from "../Actions/withdrawEnergy"; import { WorkerDefinition } from "./worker"; export const Upgrader: WorkerDefinition = { - runAction: (creep: Creep, spawn: StructureSpawn) => runAction(creep, withdrawEnergy( creep.pos.findClosestByRange(FIND_STRUCTURES, { filter: { structureType: STRUCTURE_CONTAINER }}))) + runAction: (creep: Creep, spawn: StructureSpawn) => runAction(creep, withdrawEnergy(creep.pos.findClosestByRange(FIND_STRUCTURES, { filter: { structureType: STRUCTURE_CONTAINER }}) as StructureContainer | null)) .or(harvestFromClosestActiveSource()) .andThen(transferEnergy(spawn)) - .or(transferEnergy( creep.pos.findClosestByRange(FIND_MY_STRUCTURES, { filter: (structure: StructureExtension) => structure.structureType === STRUCTURE_EXTENSION && structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0}))) + .or(transferEnergy(creep.pos.findClosestByRange(FIND_MY_STRUCTURES, { filter: (structure: AnyOwnedStructure) => structure.structureType === STRUCTURE_EXTENSION && structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0}) as StructureExtension | null)) .or(creep.room.controller ? upgradeController(creep.room.controller) : Fail) .repeat(), name: 'upgrader',