diff --git a/src/international/collective.ts b/src/international/collective.ts index 4a1d6f3bb..b19f10138 100644 --- a/src/international/collective.ts +++ b/src/international/collective.ts @@ -351,12 +351,13 @@ export class CollectiveManager { static getFunnelingRoomNames() { - const funnelTargets = new Set() // How much energy we are allowed to distribute each tick of funneling let funnelDistribution = 0 const funnelTargetQuotas: { [roomName: string]: number } = {} const funnelOrder = this.getFunnelOrder() + + const funnelTargets = new Set() funnelTargets.add(funnelOrder[0]) for (const roomName of funnelOrder) { @@ -370,6 +371,8 @@ export class CollectiveManager { funnelDistribution += desiredStrength - maxUpgradeStrength continue } + // If we are RCL 8, no need for us to get funneled + if (room.controller.level === 8) continue funnelTargetQuotas[roomName] = maxUpgradeStrength } @@ -378,6 +381,7 @@ export class CollectiveManager { LogOps.log('Funnel quotas', `distribution: ${funnelDistribution}, quotas: ${JSON.stringify(funnelTargetQuotas)}`, { type: LogTypes.debug }) } + if (Object.keys(funnelTargetQuotas).length === 0) return new Set(); if (funnelDistribution === 0) return funnelTargets for (const roomName in funnelTargetQuotas) { diff --git a/src/room/commune/spawning/spawnRequests.ts b/src/room/commune/spawning/spawnRequests.ts index 1817bfd1a..c4c8b3e73 100644 --- a/src/room/commune/spawning/spawnRequests.ts +++ b/src/room/commune/spawning/spawnRequests.ts @@ -856,7 +856,7 @@ export class SpawnRequestsManager { // If there is a terminal and it is sufficient RCL, and there's a funnel target and we aren't it, then don't allow upgraders to spawn if (this.communeManager.room.terminal && this.communeManager.room.controller.level >= 6) { const funnelingRoomNames = CollectiveManager.getFunnelingRoomNames() - if (!funnelingRoomNames.has(this.communeManager.room.name)) { + if (funnelingRoomNames.size > 0 && !funnelingRoomNames.has(this.communeManager.room.name)) { return false } } diff --git a/src/room/creeps/powerCreeps/operator.ts b/src/room/creeps/powerCreeps/operator.ts index e12162b16..6bf4b009b 100644 --- a/src/room/creeps/powerCreeps/operator.ts +++ b/src/room/creeps/powerCreeps/operator.ts @@ -303,7 +303,7 @@ export class Operator extends PowerCreep { // this.powered = true - delete Memory.powerCreeps[CreepMemoryKeys.powerTask] + delete Memory.powerCreeps[this.name][CreepMemoryKeys.powerTask] return Result.success } diff --git a/src/room/remotePlanner.ts b/src/room/remotePlanner.ts index 620545f58..254997989 100644 --- a/src/room/remotePlanner.ts +++ b/src/room/remotePlanner.ts @@ -1,3 +1,4 @@ + import { CPUMaxPerTick, defaultRoadPlanningPlainCost, diff --git a/src/room/roomNameUtils.ts b/src/room/roomNameUtils.ts index bdb94ab07..0ba36c4ba 100644 --- a/src/room/roomNameUtils.ts +++ b/src/room/roomNameUtils.ts @@ -73,9 +73,16 @@ export class RoomNameUtils { const searchRoom = Game.rooms[searchRoomName] if (!searchRoom) return + const distance = this.advancedFindDistance(roomName, searchRoomName) + + if (distance === 1) { + communeScore = 10000 + return + } + const score = Math.pow( - Math.abs(this.advancedFindDistance(roomName, searchRoomName) - preferredCommuneRange), + Math.abs(distance - preferredCommuneRange), 1.8, ) + (maxControllerLevel - searchRoom.controller.level)