mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-30 01:52:11 +00:00
added deployment
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import {defaultConfig} from "../core/configuration/DefaultConfig";
|
||||
import {TerrainMap} from "../core/Game";
|
||||
import {PseudoRandom} from "../core/PseudoRandom";
|
||||
import {ServerMessage, ServerMessageSchema} from "../core/Schemas";
|
||||
import {loadTerrainMap} from "../core/TerrainMapLoader";
|
||||
import {generateUniqueID} from "../core/Util";
|
||||
import {ClientGame, createClientGame} from "./ClientGame";
|
||||
import {v4 as uuidv4} from 'uuid';
|
||||
|
||||
@@ -18,6 +18,8 @@ class Client {
|
||||
private lobbiesContainer: HTMLElement | null;
|
||||
private lobbiesInterval: NodeJS.Timeout | null = null;
|
||||
|
||||
private random = new PseudoRandom(1234)
|
||||
|
||||
constructor() {
|
||||
this.lobbiesContainer = document.getElementById('lobbies-container');
|
||||
|
||||
@@ -84,7 +86,7 @@ class Client {
|
||||
if (this.game != null) {
|
||||
return
|
||||
}
|
||||
this.game = createClientGame(getUsername(), generateUniqueID(), lobbyID, defaultConfig, map)
|
||||
this.game = createClientGame(getUsername(), this.random.nextID(), lobbyID, defaultConfig, map)
|
||||
this.game.joinLobby()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ export class ClientGame {
|
||||
) { }
|
||||
|
||||
public joinLobby() {
|
||||
this.socket = new WebSocket(`ws://localhost:3000`)
|
||||
const wsHost = process.env.WEBSOCKET_URL || window.location.host;
|
||||
this.socket = new WebSocket(`ws://${wsHost}`)
|
||||
this.socket.onopen = () => {
|
||||
console.log('Connected to game server!');
|
||||
this.socket.send(
|
||||
|
||||
Reference in New Issue
Block a user