mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-27 05:24:36 +00:00
added deployment
This commit is contained in:
@@ -3,8 +3,8 @@ import {Client} from "./Client";
|
||||
import {Lobby} from "./Lobby";
|
||||
import {GameServer} from "./GameServer";
|
||||
import {Config} from "../core/configuration/Config";
|
||||
import {generateUniqueID} from "../core/Util";
|
||||
import {defaultConfig} from "../core/configuration/DefaultConfig";
|
||||
import {PseudoRandom} from "../core/PseudoRandom";
|
||||
|
||||
export class GameManager {
|
||||
|
||||
@@ -14,6 +14,8 @@ export class GameManager {
|
||||
|
||||
private games: Map<GameID, GameServer> = new Map()
|
||||
|
||||
private random = new PseudoRandom(123)
|
||||
|
||||
constructor(private settings: Config) { }
|
||||
|
||||
|
||||
@@ -42,7 +44,7 @@ export class GameManager {
|
||||
}
|
||||
|
||||
startGame(lobby: Lobby) {
|
||||
const gs = new GameServer(generateUniqueID(), lobby.clients, defaultConfig)
|
||||
const gs = new GameServer(this.random.nextID(), lobby.clients, defaultConfig)
|
||||
this.games.set(gs.id, gs)
|
||||
gs.start()
|
||||
}
|
||||
@@ -61,7 +63,7 @@ export class GameManager {
|
||||
|
||||
if (now > this.lastNewLobby + this.settings.lobbyCreationRate()) {
|
||||
this.lastNewLobby = now
|
||||
this.addLobby(new Lobby(generateUniqueID(), this.settings.lobbyLifetime()))
|
||||
this.addLobby(new Lobby(this.random.nextID(), this.settings.lobbyLifetime()))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user