From 89d330cf649f363fa6a6a3c1ab9892b85fb5e071 Mon Sep 17 00:00:00 2001 From: FrederikJA Date: Mon, 11 May 2026 22:04:00 +0200 Subject: [PATCH] Make setting for go to player on spawn (default on) (#3874) If this PR fixes an issue, link it below. If not, delete these two lines. Resolves #3847 ## Description: Makes a setting to turn off go to player on spawn. Most players i have played with are really annoyed about this feature. I understand that some people like it, which is why i have made it default on. But i feel like we should be able to turn it off. ## Please complete the following: - [ ] 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 - [ ] I have added relevant tests to the test directory - [ ] 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: FrederikJA --- resources/lang/en.json | 2 ++ src/client/ClientGameRunner.ts | 5 ++++- src/client/UserSettingModal.ts | 18 ++++++++++++++++++ src/core/game/UserSettings.ts | 8 ++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/resources/lang/en.json b/resources/lang/en.json index 877f9b5cd..0b99d5952 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -705,6 +705,8 @@ "coordinate_grid_desc": "Toggle the alphanumeric grid overlay", "attacking_troops_overlay_label": "Attacking Troops Overlay", "attacking_troops_overlay_desc": "Show attacker vs defender troop counts on active front lines.", + "go_to_player_label": "Go to player on start", + "go_to_player_desc": "Toggle zooming in on the player in the beginning of a game.", "performance_overlay_label": "Performance Overlay", "performance_overlay_desc": "Toggle the performance overlay. When enabled, the performance overlay will be displayed. Press shift-D during game to toggle.", "easter_writing_speed_label": "Writing Speed Multiplier", diff --git a/src/client/ClientGameRunner.ts b/src/client/ClientGameRunner.ts index 51f29e6fd..401a5c2ee 100644 --- a/src/client/ClientGameRunner.ts +++ b/src/client/ClientGameRunner.ts @@ -291,6 +291,7 @@ async function createClientGame( worker, gameView, soundManager, + userSettings, ); } catch (err) { soundManager.dispose(); @@ -322,6 +323,7 @@ export class ClientGameRunner { private worker: WorkerClient, private gameView: GameView, private soundManager: SoundManager, + private userSettings: UserSettings, ) { this.lastMessageTime = Date.now(); } @@ -534,7 +536,8 @@ export class ClientGameRunner { if ( !this.gameView.inSpawnPhase() && !hasGoneToPlayer && - this.gameView.myPlayer() + this.gameView.myPlayer() && + this.userSettings.goToPlayer() ) { hasGoneToPlayer = true; this.eventBus.emit(new GoToPlayerEvent(this.gameView.myPlayer()!, 8)); diff --git a/src/client/UserSettingModal.ts b/src/client/UserSettingModal.ts index 5bc6f0432..6e11e3db0 100644 --- a/src/client/UserSettingModal.ts +++ b/src/client/UserSettingModal.ts @@ -309,6 +309,15 @@ export class UserSettingModal extends BaseModal { ); } + private toggleGoToPlayer() { + this.userSettings.toggleGoToPlayer(); + + console.log( + "🔍 Go to player:", + this.userSettings.goToPlayer() ? "ON" : "OFF", + ); + } + private togglePerformanceOverlay() { this.userSettings.togglePerformanceOverlay(); } @@ -842,6 +851,15 @@ export class UserSettingModal extends BaseModal { @change=${this.toggleTerritoryPatterns} > + + +