mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 07:50:45 +00:00
streamer mode bugfix (#3953)
## Description: fixes https://github.com/openfrontio/OpenFrontIO/issues/3572 streamer mode bufix ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: w.o.n
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
GameMode,
|
||||
UnitType,
|
||||
} from "../core/game/Game";
|
||||
import { UserSettings } from "../core/game/UserSettings";
|
||||
import {
|
||||
ClientInfo,
|
||||
GameConfig,
|
||||
@@ -92,6 +93,7 @@ export class HostLobbyModal extends BaseModal {
|
||||
private botsUpdateTimer: number | null = null;
|
||||
private nationsUpdateTimer: number | null = null;
|
||||
private mapLoader = terrainMapFileLoader;
|
||||
private userSettings = new UserSettings();
|
||||
|
||||
private leaveLobbyOnClose = true;
|
||||
|
||||
@@ -130,9 +132,18 @@ export class HostLobbyModal extends BaseModal {
|
||||
}
|
||||
|
||||
private updateHistory(url: string): void {
|
||||
if (!crazyGamesSDK.isOnCrazyGames()) {
|
||||
history.replaceState(null, "", url);
|
||||
if (crazyGamesSDK.isOnCrazyGames()) {
|
||||
return;
|
||||
}
|
||||
history.replaceState(null, "", url);
|
||||
}
|
||||
|
||||
private updateLobbyHistory(lobbyUrl: string): void {
|
||||
if (crazyGamesSDK.isOnCrazyGames()) {
|
||||
return;
|
||||
}
|
||||
const lobbyIdHidden = !this.userSettings.lobbyIdVisibility();
|
||||
history.replaceState(null, "", lobbyIdHidden ? "/streamer-mode" : lobbyUrl);
|
||||
}
|
||||
|
||||
private startLobbyUpdates() {
|
||||
@@ -426,7 +437,7 @@ export class HostLobbyModal extends BaseModal {
|
||||
// Copy immediately so the host can share the link without waiting for the
|
||||
// server. If lobby creation fails, clear the clipboard to avoid a dead link.
|
||||
void this.constructUrl().then(async (url) => {
|
||||
this.updateHistory(url);
|
||||
this.updateLobbyHistory(url);
|
||||
await this.updateComplete;
|
||||
void (this.querySelector("copy-button") as CopyButton)?.handleCopy();
|
||||
});
|
||||
@@ -926,7 +937,7 @@ export class HostLobbyModal extends BaseModal {
|
||||
? this.spawnImmunityDurationMinutes * 60 * 10
|
||||
: 0;
|
||||
const url = await this.constructUrl();
|
||||
this.updateHistory(url);
|
||||
this.updateLobbyHistory(url);
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("update-game-config", {
|
||||
detail: {
|
||||
|
||||
Reference in New Issue
Block a user