mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-29 02:34:20 +00:00
Added checkboxes to disable Bots and NPCs for single player and private lobbies
This commit is contained in:
@@ -58,9 +58,11 @@ export class GameRunner {
|
||||
) {}
|
||||
|
||||
init() {
|
||||
this.game.addExecution(
|
||||
...this.execManager.spawnBots(this.game.config().numBots())
|
||||
);
|
||||
if (this.game.config().spawnBots()) {
|
||||
this.game.addExecution(
|
||||
...this.execManager.spawnBots(this.game.config().numBots())
|
||||
);
|
||||
}
|
||||
if (this.game.config().spawnNPCs()) {
|
||||
this.game.addExecution(...this.execManager.fakeHumanExecutions());
|
||||
}
|
||||
|
||||
@@ -92,6 +92,8 @@ const GameConfigSchema = z.object({
|
||||
gameMap: z.nativeEnum(GameMapType),
|
||||
difficulty: z.nativeEnum(Difficulty),
|
||||
gameType: z.nativeEnum(GameType),
|
||||
disableBots: z.boolean(),
|
||||
disableNPCs: z.boolean(),
|
||||
});
|
||||
|
||||
const SafeString = z
|
||||
|
||||
@@ -70,6 +70,7 @@ export interface Config {
|
||||
percentageTilesOwnedToWin(): number;
|
||||
numBots(): number;
|
||||
spawnNPCs(): boolean;
|
||||
spawnBots(): boolean;
|
||||
numSpawnPhaseTurns(): number;
|
||||
|
||||
startManpower(playerInfo: PlayerInfo): number;
|
||||
|
||||
@@ -76,7 +76,10 @@ export class DefaultConfig implements Config {
|
||||
return 5;
|
||||
}
|
||||
spawnNPCs(): boolean {
|
||||
return true;
|
||||
return !this._gameConfig.disableNPCs;
|
||||
}
|
||||
spawnBots(): boolean {
|
||||
return !this._gameConfig.disableBots;
|
||||
}
|
||||
tradeShipGold(dist: number): Gold {
|
||||
return 10000 + 100 * Math.pow(dist, 1.1);
|
||||
|
||||
Reference in New Issue
Block a user