Skip to content

Commit

Permalink
Adds a force option to the botSpawn configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
refringe committed Aug 23, 2023
1 parent 496ee7c commit efe6850
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
6 changes: 5 additions & 1 deletion config/config.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Enables verbose logging for debugging. And I mean *verbose*... It will log *everything*; raid times, train
// schedules, and every existing and newly created bot spawn wave in the system.
debug: false,
debug: true,
},

raidTimes: {
Expand Down Expand Up @@ -47,6 +47,10 @@
// known conflicts with other mods.
adjustWaves: true,

// Want to force this mod to extend the bot spawn waves, even if it detects a conflict with another mod?
// Set this to `true` and roll the dice! OH YEAHHHHH! (Not responsible for any issues that arise from this.)
force: false,

// Maximum number of bots that can be alive at once. Reduce if performance issues arise.
maximumBots: 28,

Expand Down
13 changes: 11 additions & 2 deletions src/config/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ export async function getConfig(container: DependencyContainer): Promise<Configu
return null;
}

// Adjust the configuration file for incompatible mods.
return adjustForIncompatibleMods(container, config) as Configuration;
// Adjust the configuration file for incompatible mods, unless we're using the 'force'. ;)
if (!config.botSpawn.force) {
config = adjustForIncompatibleMods(container, config);
} else if (config.general.debug) {
logger.log(
'CustomRaidTimes: Checking for incompatibilities with other mods has been skipped. Ramming speed engaged!',
'gray'
);
}

return config;
}
5 changes: 5 additions & 0 deletions src/config/validateConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ function isValidBotSpawn(botSpawn: BotSpawn): string | null {
return 'The botSpawn setting "adjustWaves" should be a boolean.';
}

// Validate 'force' property
if (typeof botSpawn.force !== 'boolean') {
return 'The botSpawn setting "force" should be a boolean.';
}

// Validate 'maximumBots' property
if (typeof botSpawn.maximumBots !== 'number' || botSpawn.maximumBots < 0) {
return 'The botSpawn setting "maximumBots" should be a non-negative number.';
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface CustomTimes {

export interface BotSpawn {
adjustWaves: boolean;
force: boolean;
maximumBots: number;
wavesPerGroup: { max: number; min: number };
groupGapMinutes: { max: number; min: number };
Expand Down

0 comments on commit efe6850

Please sign in to comment.