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

BUGFIX: BootstrappingOverlord fillers get stuck #197

Open
wants to merge 2 commits into
base: dev
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
26 changes: 16 additions & 10 deletions src/overlords/situational/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@ export class BootstrappingOverlord extends Overlord {
constructor(directive: DirectiveBootstrap, priority = OverlordPriority.emergency.bootstrap) {
super(directive, 'bootstrap', priority);
this.fillers = this.zerg(Roles.filler);
// Calculate structures fillers can supply / withdraw from
this.supplyStructures = _.filter([...this.colony.spawns, ...this.colony.extensions],
structure => structure.energy < structure.energyCapacity);
this.withdrawStructures = _.filter(_.compact([this.colony.storage!,
this.colony.terminal!,
this.colony.powerSpawn!,
...this.room.containers,
...this.room.links,
...this.room.towers,
...this.room.labs]), structure => structure.energy > 0);
// Pick up all possible structures first
this.supplyStructures = [...this.colony.spawns, ...this.colony.extensions];
this.withdrawStructures = _.compact([this.colony.storage!,
this.colony.terminal!,
this.colony.powerSpawn!,
...this.room.containers,
...this.room.links,
...this.room.towers,
...this.room.labs]);
}

private spawnBootstrapMiners() {
Expand Down Expand Up @@ -142,8 +141,15 @@ export class BootstrappingOverlord extends Overlord {
}

run() {
let toUpdate = true;
for (const filler of this.fillers) {
if (filler.isIdle) {
if (toUpdate) {
toUpdate = false
// Filter valid structures fillers can supply / withdraw from
this.supplyStructures = _.filter(this.supplyStructures, structure => structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0);
this.withdrawStructures = _.filter(this.withdrawStructures, structure => structure.store.energy > 0);
}
this.handleFiller(filler);
}
filler.run();
Expand Down