-
Notifications
You must be signed in to change notification settings - Fork 159
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
SKoutpost directive and overload: improvements and fixes #134
Changes from 17 commits
fa85104
1725754
458220b
0419b12
d98ceda
5064107
2235352
92fcb30
0d8ab06
5c1ee27
ae83f31
863fd3f
2371f0e
e72592d
709231c
b28e28e
7cd05ee
ba13e30
6821128
fab0e98
507a351
e059b48
f55d19f
11604c9
4a35d8d
0a9ae07
c34a87b
6989120
a928988
9bb8fb9
6d6b4a5
54645a4
4a5e2b6
e432131
edff4be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import {SourceReaperOverlord} from '../../overlords/mining/sourceKeeperReeper'; | ||
import {profile} from '../../profiler/decorator'; | ||
import {Directive} from '../Directive'; | ||
import {Cartographer, ROOMTYPE_SOURCEKEEPER} from '../../utilities/Cartographer'; | ||
|
||
|
||
interface DirectiveSKOutpostMemory extends FlagMemory { | ||
isCenterRoom?: boolean; | ||
} | ||
/** | ||
* Remote mining directive for source keeper rooms | ||
*/ | ||
|
@@ -12,21 +15,74 @@ export class DirectiveSKOutpost extends Directive { | |
static directiveName = 'outpostSK'; | ||
static color = COLOR_PURPLE; | ||
static secondaryColor = COLOR_YELLOW; | ||
static containerRepairTheshold = 0.5; | ||
|
||
memory: DirectiveSKOutpostMemory; | ||
|
||
constructor(flag: Flag) { | ||
super(flag, colony => colony.level >= 7); | ||
} | ||
|
||
isCenterRoom(): boolean { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is unnecessary; use something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done, check latest PR |
||
const coords = Cartographer.getRoomCoordinates(this.pos.roomName); | ||
if(coords.x % 10 != 0 && coords.x % 5 == 0 && coords.y % 10 != 0 && coords.y % 5== 0){ | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
spawnMoarOverlords() { | ||
this.overlords.sourceReaper = new SourceReaperOverlord(this); | ||
if(this.memory.isCenterRoom == undefined){ | ||
this.memory.isCenterRoom = this.isCenterRoom(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't store There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done, it is now checked in constructor. |
||
} | ||
//skip sourceReapoers for safe SKrooms | ||
if(!this.memory.isCenterRoom){ | ||
this.overlords.sourceReaper = new SourceReaperOverlord(this); | ||
} | ||
} | ||
|
||
getContainerConstructionSites(): ConstructionSite | undefined { | ||
if (!this.pos.isVisible) { | ||
return; | ||
} | ||
const ContainerConstructionSites = _.filter(this.room!.constructionSites, s => s.structureType == STRUCTURE_CONTAINER); | ||
|
||
if(ContainerConstructionSites.length > 0){ | ||
return ContainerConstructionSites[0]; | ||
} | ||
return; | ||
} | ||
|
||
getContainersToRepair(): Structure | undefined { | ||
if (!this.pos.isVisible) { | ||
return; | ||
} | ||
const containersTorepair = _.filter(this.room!.structures, s => s.structureType == STRUCTURE_CONTAINER && s.hits < DirectiveSKOutpost.containerRepairTheshold * s.hitsMax); | ||
|
||
if(containersTorepair.length > 0){ | ||
return containersTorepair[0]; | ||
} | ||
return; | ||
} | ||
|
||
init(): void { | ||
// Add this structure/CS to worker overlord's build/repair list | ||
if(Game.time % 150 == 0){ | ||
const containerNeedRepair = this.getContainersToRepair(); | ||
if (containerNeedRepair && !this.colony.overlords.work.repairStructures.includes(containerNeedRepair)) { | ||
this.colony.overlords.work.repairStructures.push(containerNeedRepair); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sk miners already build and repair their own containers -- why do you want to offload this to the colony workers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drones that harvest minerals do not repair their containers like the drones harvesting energy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this changes does not have a filter for mineral container only, the worker will repair all containers in SKroom below 50%, which will most probably apply to mineral container being below the threshold |
||
return; | ||
} | ||
|
||
const containerToBuild = this.getContainerConstructionSites(); | ||
if (containerToBuild && !this.colony.overlords.work.constructionSites.includes(containerToBuild)) { | ||
this.colony.overlords.work.constructionSites.push(containerToBuild); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
run(): void { | ||
|
||
} | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ export class DirectiveExtract extends Directive { | |
} | ||
|
||
spawnMoarOverlords() { | ||
let priority: number; | ||
let priority: number; | ||
if (this.room && this.room.my) { | ||
if (this.colony.level == 8) { | ||
priority = OverlordPriority.ownedRoom.mineralRCL8; | ||
|
@@ -36,7 +36,10 @@ export class DirectiveExtract extends Directive { | |
} else { | ||
priority = OverlordPriority.remoteSKRoom.mineral; | ||
} | ||
this.overlords.extract = new ExtractorOverlord(this, priority); | ||
//Fix: Only spawn drones if there is a terminal or storage | ||
if (!!this.colony.terminal || !!this.colony.storage){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch |
||
this.overlords.extract = new ExtractorOverlord(this, priority); | ||
} | ||
} | ||
|
||
init() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,16 @@ export class ExtractorOverlord extends Overlord { | |
} | ||
|
||
private handleDrone(drone: Zerg): void { | ||
//fix: if there is no container, then transfer the minerals yourself! | ||
if(!this.container && _.sum(drone.carry) == drone.carryCapacity ){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we probably just shouldn't spawn any extractors unless there is a container There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea, |
||
const dropoffPoints: (StructureTerminal | StructureStorage)[] = _.compact([this.colony.terminal!]); | ||
const bestDropoffPoint = drone.pos.findClosestByMultiRoomRange(dropoffPoints); | ||
if (bestDropoffPoint) { | ||
drone.task = Tasks.transferAll(bestDropoffPoint); | ||
return; | ||
} | ||
} | ||
|
||
// Ensure you are in the assigned room | ||
if (drone.room == this.room && !drone.pos.isEdge) { | ||
if (_.sum(drone.carry) == 0) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,7 @@ export class SourceReaperOverlord extends CombatOverlord { | |
reaper.healSelfIfPossible(); | ||
} | ||
// Kite around ranged invaders until a defender arrives | ||
if (this.room.invaders.length > 2 && _.filter(this.defenders, def => def.room == this.room).length == 0) { | ||
if (this.pos.findInRange(this.room.invaders,10).length > 2 && _.filter(this.defenders, def => def.room == this.room).length == 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will revert this one back. |
||
reaper.kite(_.filter(this.room.hostiles, hostile => hostile.getActiveBodyparts(RANGED_ATTACK) > 0)); | ||
reaper.healSelfIfPossible(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hesitant to make changes to dependencies, as it can break the checksum generation process. Is there a reason you are updating the rollup plugin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, check latest PR