diff --git a/src/client/graphics/layers/WinModal.ts b/src/client/graphics/layers/WinModal.ts index c2bfd2528..5fdf03478 100644 --- a/src/client/graphics/layers/WinModal.ts +++ b/src/client/graphics/layers/WinModal.ts @@ -149,7 +149,7 @@ export class WinModal extends LitElement implements Layer { return html`

${this._title || ""}

- ${this.supportHTML()} + ${this.innerHtml()}
@@ -158,34 +158,31 @@ export class WinModal extends LitElement implements Layer { `; } - updated(changedProperties) { - super.updated(changedProperties); - // Initialize ads if modal is visible and showing ads - if (changedProperties.has("isVisible") && this.isVisible && !this.won) { - try { - setTimeout(() => { - (adsbygoogle = window.adsbygoogle || []).push({}); - }, 0); - } catch (error) { - console.error("Error initializing ad:", error); - } - } - } - - supportHTML() { + innerHtml() { return html` -
+

- Like the game? Help make this my full-time project! - - Support the game! - + Time's running out!
+ I need your support to continue working on OpenFront full-time. Please + donate now to keep the updates, new features, and improvements coming.

+ + Support on Patreon +
`; } diff --git a/src/client/index.html b/src/client/index.html index 16eaed4b8..8688200cb 100644 --- a/src/client/index.html +++ b/src/client/index.html @@ -184,7 +184,7 @@ /> -
v21.0
+
v21.1
diff --git a/src/server/MapPlaylist.ts b/src/server/MapPlaylist.ts index 5fdd442f8..5c3d89633 100644 --- a/src/server/MapPlaylist.ts +++ b/src/server/MapPlaylist.ts @@ -1,4 +1,4 @@ -import { GameMapType } from "../core/game/Game"; +import { GameMapType, GameMode } from "../core/game/Game"; import { PseudoRandom } from "../core/PseudoRandom"; enum PlaylistType { @@ -9,6 +9,9 @@ enum PlaylistType { const random = new PseudoRandom(123); export class MapPlaylist { + private gameModeRotation = [GameMode.FFA, GameMode.FFA, GameMode.Team]; + private currentGameModeIndex = 0; + private mapsPlaylistBig: GameMapType[] = []; private mapsPlaylistSmall: GameMapType[] = []; private currentPlaylistCounter = 0; @@ -20,6 +23,13 @@ export class MapPlaylist { return mapsPlaylist.shift()!; } + public getNextGameMode(): GameMode { + const nextGameMode = this.gameModeRotation[this.currentGameModeIndex]; + this.currentGameModeIndex = + (this.currentGameModeIndex + 1) % this.gameModeRotation.length; + return nextGameMode; + } + private getNextMapsPlayList(playlistType: PlaylistType): GameMapType[] { switch (playlistType) { case PlaylistType.BigMaps: diff --git a/src/server/Master.ts b/src/server/Master.ts index 3e8aecf2a..5062e4220 100644 --- a/src/server/Master.ts +++ b/src/server/Master.ts @@ -222,11 +222,22 @@ async function fetchLobbies(): Promise { return publicLobbyIDs.size; } +let lastGameMode: GameMode = GameMode.FFA; + // Function to schedule a new public game async function schedulePublicGame(playlist: MapPlaylist) { const gameID = generateID(); const map = playlist.getNextMap(); publicLobbyIDs.add(gameID); + + if (lastGameMode == GameMode.FFA) { + lastGameMode = GameMode.Team; + } else { + lastGameMode = GameMode.FFA; + } + + const gameMode = playlist.getNextGameMode(); + // Create the default public game config (from your GameManager) const defaultGameConfig = { gameMap: map, @@ -236,9 +247,9 @@ async function schedulePublicGame(playlist: MapPlaylist) { infiniteGold: false, infiniteTroops: false, instantBuild: false, - disableNPCs: false, + disableNPCs: gameMode == GameMode.Team, disableNukes: false, - gameMode: Math.random() < 0.5 ? GameMode.FFA : GameMode.Team, + gameMode: gameMode, bots: 400, } as GameConfig;