Skip to content

Commit

Permalink
fix: disable construction during bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel committed Mar 11, 2024
1 parent a9e6380 commit bbc5050
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/cli/lib/central_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ class CentralCommand {
/// but will not start new deals involving contracts.
/// Mostly this makes unit-testing easier by allowing us to disable contract
/// trading.
bool get isContractTradingEnabled => true;
bool get isContractTradingEnabled => config.enableContracts;

/// Returns true if construction trading is enabled.
bool get isConstructionTradingEnabled => true;
bool get isConstructionTradingEnabled => config.enableConstruction;

/// Minimum profit per second we expect this ship to make.
// Should set this based on the ship type and how much we expect to earn
Expand Down
15 changes: 10 additions & 5 deletions packages/cli/lib/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum GamePhase with EnumIndexOrdering {

/// Which phase are we in.
// TODO(eseidel): Make this dynamic.
const gamePhase = GamePhase.bootstrap;
GamePhase gamePhase = GamePhase.bootstrap;

/// Class for holding our hard-coded configuration values.
class Config {
Expand All @@ -29,6 +29,12 @@ class Config {
/// Whether or not we should enable mining behaviors.
final bool enableMining = gamePhase < GamePhase.exploration;

/// Whether or not we engage in construction behaviors.
final bool enableConstruction = gamePhase == GamePhase.construction;

/// Whether or not we engage in contract behaviors.
final bool enableContracts = true;

/// What behaviors count as "mining" for our enable/disable mining.
final miningBehaviors = <Behavior>{
Behavior.miner,
Expand Down Expand Up @@ -133,10 +139,9 @@ class Config {
Behavior.seeder,
Behavior.trader,
],
// TODO(eseidel): I don't think these do anything anymore:
// FleetRole.miner: [Behavior.miner],
// FleetRole.surveyor: [Behavior.surveyor],
// FleetRole.siphoner: [Behavior.siphoner],
FleetRole.miner: [Behavior.miner],
FleetRole.surveyor: [Behavior.surveyor],
FleetRole.siphoner: [Behavior.siphoner],
};

// We could put some "total value" on the idea of the gate being open
Expand Down

0 comments on commit bbc5050

Please sign in to comment.