From e4b5d58deb70a450578854372cb72bf2d54410d6 Mon Sep 17 00:00:00 2001 From: Matthew Roy Date: Mon, 15 Apr 2019 16:08:31 -0700 Subject: [PATCH 1/2] Adding task to recover terminal resources on founding new room --- src/roomPlanner/RoomPlanner.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/roomPlanner/RoomPlanner.ts b/src/roomPlanner/RoomPlanner.ts index 5da538e23..609334db0 100644 --- a/src/roomPlanner/RoomPlanner.ts +++ b/src/roomPlanner/RoomPlanner.ts @@ -10,12 +10,13 @@ import {BarrierPlanner} from './BarrierPlanner'; import {BuildPriorities, DemolishStructurePriorities} from '../priorities/priorities_structures'; import {bunkerLayout} from './layouts/bunker'; import {DirectiveTerminalRebuildState} from '../directives/terminalState/terminalState_rebuild'; -import {derefCoords, maxBy, onPublicServer} from '../utilities/utils'; +import {derefCoords, hasMinerals, maxBy, onPublicServer} from '../utilities/utils'; import {bullet} from '../utilities/stringConstants'; import {Pathing} from '../movement/Pathing'; import {isOwnedStructure} from '../declarations/typeGuards'; import {MY_USERNAME} from '../~settings'; import {Energetics} from '../logistics/Energetics'; +import {DirectiveHaul} from "../directives/resource/haul"; export interface BuildingPlannerOutput { name: string; @@ -598,6 +599,11 @@ export class RoomPlanner { && (structureType == STRUCTURE_STORAGE || structureType == STRUCTURE_TERMINAL)) { break; // don't destroy terminal or storage when under RCL4 - can use energy inside } + if (this.colony.level < 6 + && structureType == STRUCTURE_TERMINAL && hasMinerals(( structure).store)) { + DirectiveHaul.create(structure.pos); + break; // don't destroy terminal when under RCL6 if there are resources available. + } if (structureType != STRUCTURE_WALL && structureType != STRUCTURE_RAMPART) { this.memory.relocating = true; } From ca5aff84ace280d2d9066ac940c8db47f9a70c88 Mon Sep 17 00:00:00 2001 From: Matthew Roy Date: Mon, 15 Apr 2019 16:08:31 -0700 Subject: [PATCH 2/2] Adding task to recover terminal resources on founding new room --- src/roomPlanner/RoomPlanner.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/roomPlanner/RoomPlanner.ts b/src/roomPlanner/RoomPlanner.ts index 5da538e23..52023c452 100644 --- a/src/roomPlanner/RoomPlanner.ts +++ b/src/roomPlanner/RoomPlanner.ts @@ -10,12 +10,13 @@ import {BarrierPlanner} from './BarrierPlanner'; import {BuildPriorities, DemolishStructurePriorities} from '../priorities/priorities_structures'; import {bunkerLayout} from './layouts/bunker'; import {DirectiveTerminalRebuildState} from '../directives/terminalState/terminalState_rebuild'; -import {derefCoords, maxBy, onPublicServer} from '../utilities/utils'; +import {derefCoords, hasMinerals, maxBy, onPublicServer} from '../utilities/utils'; import {bullet} from '../utilities/stringConstants'; import {Pathing} from '../movement/Pathing'; import {isOwnedStructure} from '../declarations/typeGuards'; import {MY_USERNAME} from '../~settings'; import {Energetics} from '../logistics/Energetics'; +import {DirectiveHaul} from "../directives/resource/haul"; export interface BuildingPlannerOutput { name: string; @@ -598,6 +599,12 @@ export class RoomPlanner { && (structureType == STRUCTURE_STORAGE || structureType == STRUCTURE_TERMINAL)) { break; // don't destroy terminal or storage when under RCL4 - can use energy inside } + if (this.colony.level < 6 + && structureType == STRUCTURE_TERMINAL && hasMinerals(( structure).store)) { + log.notify(`Creating directive to collect resources from terminal in ${structure.pos.roomName} before demolition.`); + DirectiveHaul.create(structure.pos); + break; // don't destroy terminal when under RCL6 if there are resources available. + } if (structureType != STRUCTURE_WALL && structureType != STRUCTURE_RAMPART) { this.memory.relocating = true; }