mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
Refactors sound toggle prefs away from legacy toggles, introduces a new sound pref for jukeboxes (#71040)
## About The Pull Request Migrates sound toggle prefs away from legacy toggles, and changes all related preference checks to the modern form. Cleans up unnecessary defines linked to the old prefs. Increments the minimum save file version so a piece of old sound related code can be neatly removed. (The minimum version hasn't changed in two years anyone who hasn't played in at least that long probably doesn't even remember they had prefs saved) Splits off jukebox music into its own preference distinct from instruments. (This was actually the change that brought about this whole PR the rest of the igration just made sense to do at the same time) ## Why It's Good For The Game More granularity in sound preferences is good. It is quite reasonable for players to want to hear normal volume and largely unobtrusive instruments, without also being subjected to the aural torture of the jukebox. As implementing this wothout creating an unwelcome extra legacy toggle already required setting up a non-legacy sound toggle, it is most reasonable to migrate the other sounds at the same time. ## Changelog 🆑 qol: Jukebox music can be controlled by a new seperate preference, and is no longer linked to the instrument sound preference option. refactor: Sound related toggle preferences have been migrated away from the legacy system. Pre-existing preferences should be safely migrated but players are advised to check. /🆑
This commit is contained in:
@@ -1192,7 +1192,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
winset(src, "default.ShiftUp", "is-disabled=true")
|
||||
|
||||
/client/proc/update_ambience_pref()
|
||||
if(prefs.toggles & SOUND_AMBIENCE)
|
||||
if(prefs.read_preference(/datum/preference/toggle/sound_ambience))
|
||||
if(SSambience.ambience_listening_clients[src] > world.time)
|
||||
return // If already properly set we don't want to reset the timer.
|
||||
SSambience.ambience_listening_clients[src] = world.time + 10 SECONDS //Just wait 10 seconds before the next one aight mate? cheers.
|
||||
|
||||
@@ -20,15 +20,7 @@
|
||||
"disable_deathrattle" = DISABLE_DEATHRATTLE,
|
||||
"member_public" = MEMBER_PUBLIC,
|
||||
"sound_adminhelp" = SOUND_ADMINHELP,
|
||||
"sound_ambience" = SOUND_AMBIENCE,
|
||||
"sound_announcements" = SOUND_ANNOUNCEMENTS,
|
||||
"sound_combatmode" = SOUND_COMBATMODE,
|
||||
"sound_endofround" = SOUND_ENDOFROUND,
|
||||
"sound_instruments" = SOUND_INSTRUMENTS,
|
||||
"sound_lobby" = SOUND_LOBBY,
|
||||
"sound_midi" = SOUND_MIDI,
|
||||
"sound_prayers" = SOUND_PRAYERS,
|
||||
"sound_ship_ambience" = SOUND_SHIP_AMBIENCE,
|
||||
"split_admin_tabs" = SPLIT_ADMIN_TABS,
|
||||
)
|
||||
|
||||
@@ -110,14 +102,6 @@
|
||||
else
|
||||
preferences.toggles &= ~legacy_flag
|
||||
|
||||
// I know this looks silly, but this is the only one that cares
|
||||
// and NO NEW LEGACY TOGGLES should ever be added.
|
||||
if (legacy_flag == SOUND_LOBBY)
|
||||
if (value && isnewplayer(user))
|
||||
user.client?.playtitlemusic()
|
||||
else
|
||||
user.stop_sound_channel(CHANNEL_LOBBYMUSIC)
|
||||
|
||||
return TRUE
|
||||
|
||||
var/legacy_chat_flag = legacy_chat_toggles[preference]
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/// Previously, sound preferences were legacy toggles.
|
||||
/// PR #71040 changed these to modern toggles.
|
||||
/// This migration transfers the player's existing preferences into the new toggles
|
||||
|
||||
/datum/preferences/proc/migrate_legacy_sound_toggles(savefile/savefile)
|
||||
write_preference(GLOB.preference_entries[/datum/preference/toggle/sound_ambience], toggles & 1<<2)
|
||||
write_preference(GLOB.preference_entries[/datum/preference/toggle/sound_announcements], toggles & 1<<11)
|
||||
write_preference(GLOB.preference_entries[/datum/preference/toggle/sound_combatmode], toggles & 1<<22)
|
||||
write_preference(GLOB.preference_entries[/datum/preference/toggle/sound_endofround], toggles & 1<<20)
|
||||
write_preference(GLOB.preference_entries[/datum/preference/toggle/sound_instruments], toggles & 1<<7)
|
||||
write_preference(GLOB.preference_entries[/datum/preference/toggle/sound_lobby], toggles & 1<<3)
|
||||
write_preference(GLOB.preference_entries[/datum/preference/toggle/sound_midi], toggles & 1<<1)
|
||||
write_preference(GLOB.preference_entries[/datum/preference/toggle/sound_ship_ambience], toggles & 1<<8)
|
||||
@@ -0,0 +1,63 @@
|
||||
/// Controls hearing ambience
|
||||
/datum/preference/toggle/sound_ambience
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_ambience"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/// Controls hearing announcement sounds
|
||||
/datum/preference/toggle/sound_announcements
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_announcements"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/// Controls hearing the combat mode toggle sound
|
||||
/datum/preference/toggle/sound_combatmode
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_combatmode"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/// Controls hearing round end sounds
|
||||
/datum/preference/toggle/sound_endofround
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_endofround"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/// Controls hearing instruments
|
||||
/datum/preference/toggle/sound_instruments
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_instruments"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/// Controls hearing dance machines
|
||||
/datum/preference/toggle/sound_jukebox
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_jukebox"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/datum/preference/toggle/sound_jukebox/apply_to_client_updated(client/client, value)
|
||||
if (!value)
|
||||
client.mob.stop_sound_channel(CHANNEL_JUKEBOX)
|
||||
|
||||
/// Controls hearing lobby music
|
||||
/datum/preference/toggle/sound_lobby
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_lobby"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/datum/preference/toggle/sound_lobby/apply_to_client_updated(client/client, value)
|
||||
if (value && isnewplayer(client.mob))
|
||||
client.playtitlemusic()
|
||||
else
|
||||
client.mob.stop_sound_channel(CHANNEL_LOBBYMUSIC)
|
||||
|
||||
/// Controls hearing admin music
|
||||
/datum/preference/toggle/sound_midi
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_midi"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/// Controls hearing ship ambience
|
||||
/datum/preference/toggle/sound_ship_ambience
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_ship_ambience"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
@@ -5,7 +5,7 @@
|
||||
// You do not need to raise this if you are adding new values that have sane defaults.
|
||||
// Only raise this value when changing the meaning/format/name/layout of an existing value
|
||||
// where you would want the updater procs below to run
|
||||
#define SAVEFILE_VERSION_MAX 42
|
||||
#define SAVEFILE_VERSION_MAX 43
|
||||
|
||||
/*
|
||||
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
|
||||
@@ -42,9 +42,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
//if your savefile is 3 months out of date, then 'tough shit'.
|
||||
|
||||
/datum/preferences/proc/update_preferences(current_version, savefile/S)
|
||||
if(current_version < 33)
|
||||
toggles |= SOUND_ENDOFROUND
|
||||
|
||||
if(current_version < 34)
|
||||
write_preference(/datum/preference/toggle/auto_fit_viewport, TRUE)
|
||||
|
||||
@@ -103,6 +100,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
if (current_version < 42)
|
||||
migrate_body_types(savefile)
|
||||
|
||||
if (current_version < 43)
|
||||
migrate_legacy_sound_toggles(savefile)
|
||||
|
||||
/// checks through keybindings for outdated unbound keys and updates them
|
||||
/datum/preferences/proc/check_keybindings()
|
||||
if(!parent)
|
||||
|
||||
Reference in New Issue
Block a user