diff --git a/src/core/game/UserSettings.ts b/src/core/game/UserSettings.ts index 958410a19..fe67a52f4 100644 --- a/src/core/game/UserSettings.ts +++ b/src/core/game/UserSettings.ts @@ -237,4 +237,17 @@ export class UserSettings { setSoundEffectsVolume(volume: number): void { this.setFloat("settings.soundEffectsVolume", volume); } + + playerNameOpacity(): number { + const opacity = Math.round( + this.getFloat("settings.playerNameOpacity", 100), + ); + if (!Number.isFinite(opacity)) return 100; + return Math.max(0, Math.min(100, opacity)); + } + + setPlayerNameOpacity(opacity: number): void { + const clampedOpacity = Math.max(0, Math.min(100, Math.round(opacity))); + this.setFloat("settings.playerNameOpacity", clampedOpacity); + } }