Skip to content

Commit

Permalink
fix operator task running, invalid sourceCoord references
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonBurke committed Feb 4, 2024
1 parent 032b871 commit f97bd9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/room/creeps/powerCreeps/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ export class Operator extends PowerCreep {
taskTarget._reservePowers.add(task[CreepPowerTaskKeys.power])
}

endRun() { }
endRun() {}

// Basic tasks

runTask?() {
const creepMemory = Memory.powerCreeps[this.name]
const task = creepMemory[CreepMemoryKeys.task]
if (!task && !this.findTask()) return Result.fail
if (!creepMemory[CreepMemoryKeys.task] && !this.findTask()) {
return Result.fail
}

const taskResult = (this as any)[task[CreepTaskKeys.taskName]]()
const taskResult = (this as any)[creepMemory[CreepMemoryKeys.task][CreepTaskKeys.taskName]]()
if (!taskResult) return taskResult === Result.fail

delete creepMemory[CreepMemoryKeys.task]
Expand Down
4 changes: 3 additions & 1 deletion src/room/roomFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,8 +1344,10 @@ Room.prototype.findAdjacentPositions = function (rx, ry) {

Room.prototype.createWorkRequest = function () {
const roomMemory = Memory.rooms[this.name]
const packedSourceCoords = roomMemory[RoomMemoryKeys.sourceCoords]

if (roomMemory[RoomMemoryKeys.sourceCoords].length / packedCoordLength < 2) return false
if (!packedSourceCoords) return false
if (packedSourceCoords.length / packedCoordLength < 2) return false
if (Memory.workRequests[this.name]) return false

RoomNameUtils.findDynamicScore(this.name)
Expand Down
2 changes: 0 additions & 2 deletions src/room/roomNameOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ export class RoomNameOps {
return room.scoutEnemyRoom()
}

room.createWorkRequest()

// There is no controller owner

if (room.scoutRemote()) return roomMemory[RoomMemoryKeys.type]
Expand Down

0 comments on commit f97bd9f

Please sign in to comment.