Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover terminal resources #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/roomPlanner/RoomPlanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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((<StructureTerminal> structure).store)) {
log.notify(`Creating directive to collect resources from terminal in ${structure.pos.print} 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;
}
Expand Down