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
This commit is contained in:
FrederikJA
2026-05-11 22:04:00 +02:00
committed by GitHub
parent 19280c0b37
commit 89d330cf64
4 changed files with 32 additions and 1 deletions
+2
View File
@@ -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",
+4 -1
View File
@@ -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));
+18
View File
@@ -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}
></setting-toggle>
<!-- 🔍 Go to player -->
<setting-toggle
label="${translateText("user_setting.go_to_player_label")}"
description="${translateText("user_setting.go_to_player_desc")}"
id="go-to-player-toggle"
.checked=${this.userSettings.goToPlayer()}
@change=${this.toggleGoToPlayer}
></setting-toggle>
<!-- 📱 Performance Overlay -->
<setting-toggle
label="${translateText("user_setting.performance_overlay_label")}"
+8
View File
@@ -164,6 +164,10 @@ export class UserSettings {
return this.getBool("settings.territoryPatterns", true);
}
goToPlayer() {
return this.getBool("settings.goToPlayer", true);
}
attackingTroopsOverlay() {
return this.getBool("settings.attackingTroopsOverlay", true);
}
@@ -225,6 +229,10 @@ export class UserSettings {
this.setBool("settings.territoryPatterns", !this.territoryPatterns());
}
toggleGoToPlayer() {
this.setBool("settings.goToPlayer", !this.goToPlayer());
}
toggleDarkMode() {
this.setBool(DARK_MODE_KEY, !this.darkMode());
}