mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 10:32:41 +00:00
teammode: bots can attack each other now to prevent them from ganging up on players
This commit is contained in:
+17
-3
@@ -1,6 +1,12 @@
|
||||
import fs from "fs/promises";
|
||||
import path from "path";
|
||||
import { Difficulty, GameType } from "../../src/core/game/Game";
|
||||
import {
|
||||
Difficulty,
|
||||
Game,
|
||||
GameType,
|
||||
PlayerInfo,
|
||||
PlayerType,
|
||||
} from "../../src/core/game/Game";
|
||||
import { createGame } from "../../src/core/game/GameImpl";
|
||||
import { genTerrainFromBin } from "../../src/core/game/TerrainMapLoader";
|
||||
import { UserSettings } from "../../src/core/game/UserSettings";
|
||||
@@ -9,7 +15,11 @@ import { generateMap } from "../../src/scripts/TerrainMapGenerator";
|
||||
import { TestConfig } from "./TestConfig";
|
||||
import { TestServerConfig } from "./TestServerConfig";
|
||||
|
||||
export async function setup(mapName: string, _gameConfig: GameConfig = {}) {
|
||||
export async function setup(
|
||||
mapName: string,
|
||||
_gameConfig: GameConfig = {},
|
||||
humans: PlayerInfo[] = [],
|
||||
): Promise<Game> {
|
||||
// Load the specified map
|
||||
const mapPath = path.join(__dirname, "..", "testdata", `${mapName}.png`);
|
||||
const imageBuffer = await fs.readFile(mapPath);
|
||||
@@ -35,5 +45,9 @@ export async function setup(mapName: string, _gameConfig: GameConfig = {}) {
|
||||
const config = new TestConfig(serverConfig, gameConfig, new UserSettings());
|
||||
|
||||
// Create and return the game
|
||||
return createGame([], [], gameMap, miniGameMap, config);
|
||||
return createGame(humans, [], gameMap, miniGameMap, config);
|
||||
}
|
||||
|
||||
export function playerInfo(name: string, type: PlayerType): PlayerInfo {
|
||||
return new PlayerInfo("fr", name, type, null, name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user