From 625d54c12808d53e39cd2581773e5c7f06e49e17 Mon Sep 17 00:00:00 2001 From: a-happy-goose <288486524+a-happy-goose@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:15:34 -0300 Subject: [PATCH] [small-fix 20 lines] Add FFA collusion warning (#4107) Resolves #3900 ## Description: During the spawn phase in FFA games, display a collusion warning to clearly communicate to new users that pre-game agreement is not allowed. 2026-06-01_20-31 - [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 ## Please put your Discord username so you can be contacted if a bug or regression is found: goose126 --------- Co-authored-by: evanpelle --- resources/lang/en.json | 2 ++ src/client/hud/layers/HeadsUpMessage.ts | 39 ++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/resources/lang/en.json b/resources/lang/en.json index d467196f3..74eb025cc 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1254,6 +1254,8 @@ "heads_up_message": { "choose_spawn": "Choose a starting location", "random_spawn": "Random spawn is enabled. Selecting starting location for you...", + "ffa_collusion": "Reminder: teaming up before the game is not allowed in FFA", + "dont_show_again": "Don't show again", "singleplayer_game_paused": "Game paused", "multiplayer_game_paused": "Game paused by Lobby Creator", "pvp_immunity_active": "PVP immunity active for {seconds}s", diff --git a/src/client/hud/layers/HeadsUpMessage.ts b/src/client/hud/layers/HeadsUpMessage.ts index d7970ea32..7bc6ee9b9 100644 --- a/src/client/hud/layers/HeadsUpMessage.ts +++ b/src/client/hud/layers/HeadsUpMessage.ts @@ -1,11 +1,13 @@ import { LitElement, html } from "lit"; import { customElement, state } from "lit/decorators.js"; -import { GameType } from "../../../core/game/Game"; +import { GameMode, GameType } from "../../../core/game/Game"; import { GameUpdateType } from "../../../core/game/GameUpdates"; import { GameView } from "../../../core/game/GameView"; import { Controller } from "../../Controller"; import { translateText } from "../../Utils"; +const COLLUSION_WARNING_CLOSED_KEY = "hasClosedCollusionWarning"; + @customElement("heads-up-message") export class HeadsUpMessage extends LitElement implements Controller { public game: GameView; @@ -13,6 +15,10 @@ export class HeadsUpMessage extends LitElement implements Controller { @state() private isVisible = false; + @state() + private hasClosedCollusionWarning = + localStorage.getItem(COLLUSION_WARNING_CLOSED_KEY) !== null; + @state() private isPaused = false; @@ -139,6 +145,12 @@ export class HeadsUpMessage extends LitElement implements Controller { : translateText("heads_up_message.choose_spawn"); } + private onCloseCollusionWarning = (): void => { + localStorage.setItem(COLLUSION_WARNING_CLOSED_KEY, "true"); + this.hasClosedCollusionWarning = true; + this.requestUpdate(); + }; + render() { return html`
@@ -182,6 +194,31 @@ export class HeadsUpMessage extends LitElement implements Controller {
` : null} + ${this.game.inSpawnPhase() && + this.game.config().gameConfig().gameMode === GameMode.FFA && + this.game.config().gameConfig().gameType === GameType.Public && + !this.hasClosedCollusionWarning + ? html` +
e.preventDefault()} + > +
${translateText("heads_up_message.ffa_collusion")}
+ +
+ ` + : null} `; }