mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-30 17:02:27 +00:00
moved attack config to separate config class
This commit is contained in:
@@ -2,8 +2,9 @@ import {GameID, LobbyID} from "../core/Game";
|
||||
import {Client} from "./Client";
|
||||
import {Lobby} from "./Lobby";
|
||||
import {GameServer} from "./GameServer";
|
||||
import {defaultSettings, Settings} from "../core/Settings";
|
||||
import {Config} from "../core/configuration/Config";
|
||||
import {generateUniqueID} from "../core/Util";
|
||||
import {defaultConfig} from "../core/configuration/DefaultConfig";
|
||||
|
||||
export class GameManager {
|
||||
|
||||
@@ -13,7 +14,7 @@ export class GameManager {
|
||||
|
||||
private games: Map<GameID, GameServer> = new Map()
|
||||
|
||||
constructor(private settings: Settings) { }
|
||||
constructor(private settings: Config) { }
|
||||
|
||||
|
||||
public hasLobby(lobbyID: LobbyID): boolean {
|
||||
@@ -41,7 +42,7 @@ export class GameManager {
|
||||
}
|
||||
|
||||
startGame(lobby: Lobby) {
|
||||
const gs = new GameServer(generateUniqueID(), lobby.clients, defaultSettings)
|
||||
const gs = new GameServer(generateUniqueID(), lobby.clients, defaultConfig)
|
||||
this.games.set(gs.id, gs)
|
||||
gs.start()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {EventBus} from "../core/EventBus";
|
||||
import {ClientID, GameID} from "../core/Game";
|
||||
import {ClientMessage, ClientMessageSchema, Intent, ServerStartGameMessage, ServerStartGameMessageSchema, ServerTurnMessageSchema, Turn} from "../core/Schemas";
|
||||
import {Settings} from "../core/Settings";
|
||||
import {Config} from "../core/configuration/Config";
|
||||
import {Ticker, TickEvent} from "../core/Ticker";
|
||||
import {Client} from "./Client";
|
||||
|
||||
@@ -13,7 +13,7 @@ export class GameServer {
|
||||
constructor(
|
||||
public readonly id: GameID,
|
||||
private clients: Map<ClientID, Client>,
|
||||
private settings: Settings,
|
||||
private settings: Config,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {GameManager} from './GameManager';
|
||||
import {Client} from './Client';
|
||||
import {ClientMessage, ClientMessageSchema} from '../core/Schemas';
|
||||
import {Lobby} from './Lobby';
|
||||
import {defaultSettings} from '../core/Settings';
|
||||
import {defaultConfig} from '../core/configuration/DefaultConfig';
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ const wss = new WebSocketServer({server});
|
||||
app.use(express.static(path.join(__dirname, '../../out')));
|
||||
app.use(express.json())
|
||||
|
||||
const gm = new GameManager(defaultSettings)
|
||||
const gm = new GameManager(defaultConfig)
|
||||
|
||||
// New GET endpoint to list lobbies
|
||||
app.get('/lobbies', (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user