mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 13:38:41 +01:00
[MIRROR] Refactors sound toggle prefs away from legacy toggles, introduces a new sound pref for jukeboxes [MDB IGNORE] (#17413)
* Refactors sound toggle prefs away from legacy toggles, introduces a new sound pref for jukeboxes * Update living_defense.dm * fix * Update deprivation_helmet.dm Co-authored-by: Thunder12345 <Thunder12345@users.noreply.github.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
This commit is contained in:
co-authored by
Thunder12345
Zonespace
parent
d4601ae5bc
commit
fd699e46ce
@@ -3,15 +3,9 @@
|
||||
// !!! DO NOT ADD ANY NEW ONES HERE !!!
|
||||
// Use `/datum/preference/toggle` instead.
|
||||
#define SOUND_ADMINHELP (1<<0)
|
||||
#define SOUND_MIDI (1<<1)
|
||||
#define SOUND_AMBIENCE (1<<2)
|
||||
#define SOUND_LOBBY (1<<3)
|
||||
#define MEMBER_PUBLIC (1<<4)
|
||||
#define SOUND_INSTRUMENTS (1<<7)
|
||||
#define SOUND_SHIP_AMBIENCE (1<<8)
|
||||
#define SOUND_PRAYERS (1<<9)
|
||||
#define ANNOUNCE_LOGIN (1<<10)
|
||||
#define SOUND_ANNOUNCEMENTS (1<<11)
|
||||
#define DISABLE_DEATHRATTLE (1<<12)
|
||||
#define DISABLE_ARRIVALRATTLE (1<<13)
|
||||
#define COMBOHUD_LIGHTING (1<<14)
|
||||
@@ -20,12 +14,10 @@
|
||||
#define DEADMIN_POSITION_HEAD (1<<17)
|
||||
#define DEADMIN_POSITION_SECURITY (1<<18)
|
||||
#define DEADMIN_POSITION_SILICON (1<<19)
|
||||
#define SOUND_ENDOFROUND (1<<20)
|
||||
#define ADMIN_IGNORE_CULT_GHOST (1<<21)
|
||||
#define SOUND_COMBATMODE (1<<22)
|
||||
#define SPLIT_ADMIN_TABS (1<<23)
|
||||
|
||||
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_ENDOFROUND|MEMBER_PUBLIC|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS|SOUND_COMBATMODE)
|
||||
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|MEMBER_PUBLIC|SOUND_PRAYERS)
|
||||
|
||||
// Legacy chat toggles.
|
||||
// !!! DO NOT ADD ANY NEW ONES HERE !!!
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
for(var/mob/target in players)
|
||||
if(!isnewplayer(target) && target.can_hear())
|
||||
to_chat(target, announcement)
|
||||
if(target.client.prefs.toggles & SOUND_ANNOUNCEMENTS)
|
||||
if(target.client.prefs.read_preference(/datum/preference/toggle/sound_announcements))
|
||||
SEND_SOUND(target, sound_to_play)
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@
|
||||
continue
|
||||
|
||||
to_chat(target, "[span_minorannounce("<font color = red>[title]</font color><BR>[message]")]<BR>")
|
||||
if(target.client?.prefs.toggles & SOUND_ANNOUNCEMENTS)
|
||||
if(target.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements))
|
||||
var/sound_to_play = sound_override || (alert ? 'sound/misc/notice1.ogg' : 'sound/misc/notice2.ogg')
|
||||
SEND_SOUND(target, sound(sound_to_play))
|
||||
*/ // SKYRAT EDIT REMOVAL END
|
||||
|
||||
@@ -707,7 +707,7 @@ SUBSYSTEM_DEF(ticker)
|
||||
///The reference to the end of round sound that we have chosen.
|
||||
var/sound/end_of_round_sound_ref = sound(round_end_sound)
|
||||
for(var/mob/M in GLOB.player_list)
|
||||
if(M.client.prefs?.toggles & SOUND_ENDOFROUND)
|
||||
if(M.client.prefs.read_preference(/datum/preference/toggle/sound_endofround))
|
||||
SEND_SOUND(M.client, end_of_round_sound_ref)
|
||||
|
||||
text2file(login_music, "data/last_round_lobby_music.txt")
|
||||
|
||||
@@ -194,7 +194,7 @@ SUBSYSTEM_DEF(vote)
|
||||
new_voter.player_details.player_actions += voting_action
|
||||
generated_actions += voting_action
|
||||
|
||||
if(current_vote.vote_sound && (new_voter.prefs.toggles & SOUND_ANNOUNCEMENTS))
|
||||
if(current_vote.vote_sound && (new_voter.prefs.read_preference(/datum/preference/toggle/sound_announcements)))
|
||||
SEND_SOUND(new_voter, sound(current_vote.vote_sound))
|
||||
|
||||
return TRUE
|
||||
|
||||
@@ -430,7 +430,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
|
||||
var/area/my_area = get_area(src)
|
||||
|
||||
if(!(client?.prefs.toggles & SOUND_SHIP_AMBIENCE) || !my_area.ambient_buzz)
|
||||
if(!(client?.prefs.read_preference(/datum/preference/toggle/sound_ship_ambience)) || !my_area.ambient_buzz)
|
||||
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
|
||||
return
|
||||
|
||||
|
||||
@@ -455,13 +455,13 @@
|
||||
var/sound/song_played = sound(selection.song_path)
|
||||
|
||||
for(var/mob/M in range(10,src))
|
||||
if(!M.client || !(M.client.prefs.toggles & SOUND_INSTRUMENTS))
|
||||
if(!M.client || !(M.client.prefs.read_preference(/datum/preference/toggle/sound_jukebox)))
|
||||
continue
|
||||
if(!(M in rangers))
|
||||
rangers[M] = TRUE
|
||||
M.playsound_local(get_turf(M), null, volume, channel = CHANNEL_JUKEBOX, sound_to_use = song_played, use_reverb = FALSE)
|
||||
for(var/mob/L in rangers)
|
||||
if(get_dist(src,L) > 10)
|
||||
if(get_dist(src,L) > 10 || !(L.client.prefs.read_preference(/datum/preference/toggle/sound_jukebox)))
|
||||
rangers -= L
|
||||
if(!L || !L.client)
|
||||
continue
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@
|
||||
set waitfor = FALSE
|
||||
UNTIL(SSticker.login_music) //wait for SSticker init to set the login music
|
||||
|
||||
if(prefs && (prefs.toggles & SOUND_LOBBY) && !CONFIG_GET(flag/disallow_title_music))
|
||||
if(prefs && (prefs.read_preference(/datum/preference/toggle/sound_lobby)) && !CONFIG_GET(flag/disallow_title_music))
|
||||
SEND_SOUND(src, sound(SSticker.login_music, repeat = 0, wait = 0, volume = vol, channel = CHANNEL_LOBBYMUSIC)) // MAD JAMS
|
||||
|
||||
/proc/get_rand_frequency()
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
if(SOUND_EMITTER_GLOBAL)
|
||||
hearing_mobs = GLOB.player_list.Copy()
|
||||
for(var/mob/M in hearing_mobs)
|
||||
if(M.client.prefs.toggles & SOUND_MIDI)
|
||||
if(M.client.prefs.read_preference(/datum/preference/toggle/sound_midi))
|
||||
M.playsound_local(M, sound_file, sound_volume, FALSE, channel = CHANNEL_ADMIN, pressure_affected = FALSE)
|
||||
if(user)
|
||||
log_admin("[ADMIN_LOOKUPFLW(user)] activated a sound emitter with file \"[sound_file]\" at [AREACOORD(src)]")
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
message_admins("[key_name_admin(src)] played sound [S]")
|
||||
|
||||
for(var/mob/M in GLOB.player_list)
|
||||
if(M.client.prefs.toggles & SOUND_MIDI)
|
||||
if(M.client.prefs.read_preference(/datum/preference/toggle/sound_midi))
|
||||
admin_sound.volume = vol * M.client.admin_music_volume
|
||||
SEND_SOUND(M, admin_sound)
|
||||
admin_sound.volume = vol
|
||||
@@ -146,7 +146,7 @@
|
||||
for(var/m in GLOB.player_list)
|
||||
var/mob/M = m
|
||||
var/client/C = M.client
|
||||
if(C.prefs.toggles & SOUND_MIDI)
|
||||
if(C.prefs.read_preference(/datum/preference/toggle/sound_midi))
|
||||
if(!stop_web_sounds)
|
||||
C.tgui_panel?.play_music(web_sound_url, music_extra_data)
|
||||
else
|
||||
|
||||
@@ -1230,7 +1230,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)
|
||||
|
||||
@@ -104,6 +101,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
// migrate_body_types(savefile) // SKYRAT EDIT - This'll fuck up savefiles
|
||||
migrate_mentor() // SKYRAT EDIT - Make mentors alive again
|
||||
|
||||
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)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
sender_override = "Nanotrasen Meteorology Division")
|
||||
for(var/V in GLOB.player_list)
|
||||
var/mob/M = V
|
||||
if((M.client.prefs.toggles & SOUND_MIDI) && is_station_level(M.z))
|
||||
if((M.client.prefs.read_preference(/datum/preference/toggle/sound_midi)) && is_station_level(M.z))
|
||||
M.playsound_local(M, 'sound/ambience/aurora_caelus.ogg', 20, FALSE, pressure_affected = FALSE)
|
||||
|
||||
/datum/round_event/aurora_caelus/start()
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
if(player && HAS_TRAIT(player, TRAIT_MUSICIAN) && isliving(M))
|
||||
var/mob/living/L = M
|
||||
L.apply_status_effect(/datum/status_effect/good_music)
|
||||
if(!(M?.client?.prefs?.toggles & SOUND_INSTRUMENTS))
|
||||
if(!(M?.client?.prefs.read_preference(/datum/preference/toggle/sound_instruments)))
|
||||
continue
|
||||
M.playsound_local(source, null, volume * using_instrument.volume_multiplier, sound_to_use = music_played)
|
||||
// Could do environment and echo later but not for now
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
if(player && HAS_TRAIT(player, TRAIT_MUSICIAN) && isliving(M))
|
||||
var/mob/living/L = M
|
||||
L.apply_status_effect(/datum/status_effect/good_music)
|
||||
if(!(M?.client?.prefs?.toggles & SOUND_INSTRUMENTS))
|
||||
if(!(M?.client?.prefs.read_preference(/datum/preference/toggle/sound_instruments)))
|
||||
continue
|
||||
M.playsound_local(get_turf(parent), null, volume, FALSE, K.frequency, null, channel, null, copy)
|
||||
// Could do environment and echo later but not for now
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
face_mouse = (client?.prefs?.read_preference(/datum/preference/toggle/face_cursor_combat_mode) && combat_mode) ? TRUE : FALSE
|
||||
//SKYRAT EDIT ADDITION END
|
||||
|
||||
if(silent || !(client?.prefs.toggles & SOUND_COMBATMODE))
|
||||
if(silent || !(client?.prefs.read_preference(/datum/preference/toggle/sound_combatmode)))
|
||||
return
|
||||
if(combat_mode)
|
||||
SEND_SOUND(src, sound('sound/misc/ui_togglecombat.ogg', volume = 25)) //Sound from interbay!
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
stack_trace("[player_mob] ([player_mob.ckey]) has null prefs, which shouldn't be possible!")
|
||||
continue
|
||||
|
||||
if(player_mob.can_hear() && (player_mob.client?.prefs.toggles & SOUND_ANNOUNCEMENTS))
|
||||
if(player_mob.can_hear() && (player_mob.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements)))
|
||||
var/turf/T = get_turf(player_mob)
|
||||
if(T.z == z_level)
|
||||
SEND_SOUND(player_mob, voice)
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
var/dist = get_dist(hearing_mob.loc, distant_source.loc)
|
||||
var/vol = clamp(50 - ((dist - 7) * 5), 10, 50) // Every tile decreases sound volume by 5
|
||||
if(takeoff)
|
||||
if(hearing_mob.client?.prefs?.toggles & SOUND_SHIP_AMBIENCE)
|
||||
if(hearing_mob.client?.prefs?.read_preference(/datum/preference/toggle/sound_ship_ambience))
|
||||
hearing_mob.playsound_local(distant_source, takeoff_sound, vol)
|
||||
else
|
||||
if(hearing_mob.client?.prefs?.toggles & SOUND_SHIP_AMBIENCE)
|
||||
if(hearing_mob.client?.prefs?.read_preference(/datum/preference/toggle/sound_ship_ambience))
|
||||
hearing_mob.playsound_local(distant_source, landing_sound, vol)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
for(var/m in players)
|
||||
if(ismob(m) && !isnewplayer(m))
|
||||
var/mob/M = m
|
||||
if(M.client.prefs.toggles & SOUND_ANNOUNCEMENTS && M.can_hear())
|
||||
if(M.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements) && M.can_hear())
|
||||
if(override_volume)
|
||||
M.playsound_local(get_turf(M), S, 80, FALSE)
|
||||
else
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
stack_trace("[player_mob] ([player_mob.ckey]) has null prefs, which shouldn't be possible!")
|
||||
continue
|
||||
|
||||
if(player_mob.can_hear() && (player_mob.client?.prefs.toggles & SOUND_ANNOUNCEMENTS))
|
||||
if(player_mob.can_hear() && (player_mob.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements)))
|
||||
var/turf/player_turf = get_turf(player_mob)
|
||||
if(player_turf.z == z_level)
|
||||
SEND_SOUND(player_mob, voice)
|
||||
|
||||
@@ -37,7 +37,7 @@ SUBSYSTEM_DEF(jukeboxes)
|
||||
for(var/mob/M in GLOB.player_list)
|
||||
if(!M.client)
|
||||
continue
|
||||
if(!(M.client.prefs.toggles & SOUND_INSTRUMENTS))
|
||||
if(!(M.client.prefs.read_preference(/datum/preference/toggle/sound_instruments)))
|
||||
continue
|
||||
|
||||
M.playsound_local(M, null, jukebox.volume, channel = youvegotafreejukebox[2], sound_to_use = song_to_init)
|
||||
@@ -103,7 +103,7 @@ SUBSYSTEM_DEF(jukeboxes)
|
||||
for(var/mob/M in GLOB.player_list)
|
||||
if(!M.client)
|
||||
continue
|
||||
if(!(M.client.prefs.toggles & SOUND_INSTRUMENTS) || !M.can_hear())
|
||||
if(!(M.client.prefs.read_preference(/datum/preference/toggle/sound_instruments)) || !M.can_hear())
|
||||
M.stop_sound_channel(jukeinfo[2])
|
||||
continue
|
||||
|
||||
|
||||
-174
@@ -26,13 +26,6 @@
|
||||
actions_types = list(/datum/action/item_action/toggle_vision,
|
||||
/datum/action/item_action/toggle_hearing,
|
||||
/datum/action/item_action/toggle_speech)
|
||||
//Var for save sounds status when Helmet is equipped
|
||||
var/ambience_sound_state = null
|
||||
var/instruments_sound_state = null
|
||||
var/combatmode_sound_state = null
|
||||
var/midis_sound_state = null
|
||||
var/announcement_sound_state = null
|
||||
var/ship_ambience_sound_state = null
|
||||
|
||||
//Declare action types
|
||||
/datum/action/item_action/toggle_vision
|
||||
@@ -102,7 +95,6 @@
|
||||
to_chat(usr, span_notice("Hearing switch off"))
|
||||
if(usr.get_item_by_slot(ITEM_SLOT_HEAD) == src)
|
||||
REMOVE_TRAIT(usr, TRAIT_DEAF, CLOTHING_TRAIT)
|
||||
Toggle_Sounds()
|
||||
//to_chat(U, span_purple("Finally you can hear the world around again."))
|
||||
else
|
||||
earmuffs = TRUE
|
||||
@@ -110,8 +102,6 @@
|
||||
to_chat(usr, span_notice("Hearing switch on"))
|
||||
if(usr.get_item_by_slot(ITEM_SLOT_HEAD) == src)
|
||||
ADD_TRAIT(usr, TRAIT_DEAF, CLOTHING_TRAIT)
|
||||
Toggle_Sounds()
|
||||
stop_client_sounds()
|
||||
to_chat(usr, span_purple("You can barely hear anything! Your other senses have become more apparent..."))
|
||||
if(user_client == "vision")
|
||||
var/mob/living/carbon/human/user = usr
|
||||
@@ -130,151 +120,6 @@
|
||||
user.become_blind("deprivation_helmet_[REF(src)]")
|
||||
to_chat(usr, span_purple("The helmet is blocking your vision! You can't make out anything on the other side..."))
|
||||
|
||||
// Client sound switchers for more silense! And check current state of parameters
|
||||
// Switcher agregator function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Sounds()
|
||||
var/user_client = usr.client
|
||||
if(earmuffs == FALSE)
|
||||
if(ambience_sound_state != 0)
|
||||
var/soundscape_check = Toggle_Soundscape_Get_checked(user_client)
|
||||
if(soundscape_check == 0)
|
||||
Toggle_Soundscape()
|
||||
if(instruments_sound_state != 0)
|
||||
var/instruments_check = Toggle_Instruments_Get_checked(user_client)
|
||||
if(instruments_check == 0)
|
||||
Toggle_Instruments()
|
||||
if(combatmode_sound_state != 0)
|
||||
var/combat_mode_sound_check = Toggle_Combatmode_Sound_Get_checked(user_client)
|
||||
if(combat_mode_sound_check == 0)
|
||||
Toggle_Combatmode_Sound()
|
||||
if(midis_sound_state != 0)
|
||||
var/midis_check = Toggle_Midis_Get_checked(user_client)
|
||||
if(midis_check == 0)
|
||||
Toggle_Midis()
|
||||
if(announcement_sound_state != 0)
|
||||
var/announcement_sound_check = Toggle_Announcement_Sound_Get_checked(user_client)
|
||||
if(announcement_sound_check == 0)
|
||||
Toggle_Announcement_Sound()
|
||||
if(ship_ambience_sound_state != 0)
|
||||
var/ambience_check = Toggle_Ship_Ambience_Get_Checked(user_client)
|
||||
if(ambience_check == 0)
|
||||
Toggle_Ship_Ambience()
|
||||
else
|
||||
var/soundscape_check = Toggle_Soundscape_Get_checked(user_client)
|
||||
if(soundscape_check != 0)
|
||||
Toggle_Soundscape()
|
||||
var/instruments_check = Toggle_Instruments_Get_checked(user_client)
|
||||
if(instruments_check != 0)
|
||||
Toggle_Instruments()
|
||||
var/combat_mode_sound_check = Toggle_Combatmode_Sound_Get_checked(user_client)
|
||||
if(combat_mode_sound_check != 0)
|
||||
Toggle_Combatmode_Sound()
|
||||
var/midis_check = Toggle_Midis_Get_checked(user_client)
|
||||
if(midis_check != 0)
|
||||
Toggle_Midis()
|
||||
var/announcement_sound_check = Toggle_Announcement_Sound_Get_checked(user_client)
|
||||
if(announcement_sound_check != 0)
|
||||
Toggle_Announcement_Sound()
|
||||
var/ambience_check = Toggle_Ship_Ambience_Get_Checked(user_client)
|
||||
if(ambience_check != 0)
|
||||
Toggle_Ship_Ambience()
|
||||
|
||||
//Ambience sound switch function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Soundscape()
|
||||
usr.client.prefs.toggles ^= SOUND_AMBIENCE
|
||||
usr.client.prefs.save_preferences()
|
||||
if(usr.client.prefs.toggles & SOUND_AMBIENCE)
|
||||
//to_chat(usr, "You will now hear ambient sounds.")
|
||||
else
|
||||
//to_chat(usr, "You will no longer hear ambient sounds.")
|
||||
usr.stop_sound_channel(CHANNEL_AMBIENCE)
|
||||
usr.stop_sound_channel(CHANNEL_BUZZ)
|
||||
usr.client.update_ambience_pref()
|
||||
|
||||
//Ambience sound check status function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Soundscape_Get_checked(client/user_client)
|
||||
return user_client.prefs.toggles & SOUND_AMBIENCE
|
||||
|
||||
//Instuments sound switch function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Instruments()
|
||||
usr.client.prefs.toggles ^= SOUND_INSTRUMENTS
|
||||
usr.client.prefs.save_preferences()
|
||||
if(usr.client.prefs.toggles & SOUND_INSTRUMENTS)
|
||||
//to_chat(usr, "You will now hear people playing musical instruments.")
|
||||
else
|
||||
//to_chat(usr, "You will no longer hear musical instruments.")
|
||||
|
||||
//Instruments sound check status
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Instruments_Get_checked(client/user_client)
|
||||
return user_client.prefs.toggles & SOUND_INSTRUMENTS
|
||||
|
||||
//Combat sound switch function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Combatmode_Sound()
|
||||
usr.client.prefs.toggles ^= SOUND_COMBATMODE
|
||||
usr.client.prefs.save_preferences()
|
||||
if(usr.client.prefs.toggles & SOUND_COMBATMODE)
|
||||
//to_chat(usr, "You will now hear a sound when combat mode is turned on.")
|
||||
else
|
||||
//to_chat(usr, "You will no longer hear a sound when combat mode is turned on.")
|
||||
|
||||
//Combat sound check status function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Combatmode_Sound_Get_checked(client/user_client)
|
||||
return user_client.prefs.toggles & SOUND_COMBATMODE
|
||||
|
||||
//Midis sound switch function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Midis()
|
||||
usr.client.prefs.toggles ^= SOUND_MIDI
|
||||
usr.client.prefs.save_preferences()
|
||||
if(usr.client.prefs.toggles & SOUND_MIDI)
|
||||
//to_chat(usr, "You will now hear any sounds uploaded by admins.")
|
||||
else
|
||||
//to_chat(usr, "You will no longer hear sounds uploaded by admins")
|
||||
usr.stop_sound_channel(CHANNEL_ADMIN)
|
||||
var/client/user_client = usr.client
|
||||
user_client?.tgui_panel?.stop_music()
|
||||
|
||||
//Midis sound check status function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Midis_Get_checked(client/user_client)
|
||||
return user_client.prefs.toggles & SOUND_MIDI
|
||||
//Anounce sound switch function
|
||||
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Announcement_Sound()
|
||||
set name = "Hear/Silence Announcements"
|
||||
set category = "Preferences"
|
||||
set desc = "Hear Announcement Sound"
|
||||
usr.client.prefs.toggles ^= SOUND_ANNOUNCEMENTS
|
||||
//to_chat(usr, "You will now [(usr.client.prefs.toggles & SOUND_ANNOUNCEMENTS) ? "hear announcement sounds" : "no longer hear announcements"].")
|
||||
usr.client.prefs.save_preferences()
|
||||
|
||||
//Anounce sound check status function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Announcement_Sound_Get_checked(client/user_client)
|
||||
return user_client.prefs.toggles & SOUND_ANNOUNCEMENTS
|
||||
|
||||
//Stop sound function for immediatlely silence
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/stop_client_sounds()
|
||||
SEND_SOUND(usr, sound(null))
|
||||
var/client/user_client = usr.client
|
||||
user_client?.tgui_panel?.stop_music()
|
||||
//Ship ambience switch function
|
||||
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Ship_Ambience()
|
||||
set name = "Hear/Silence Ship Ambience"
|
||||
set category = "Preferences"
|
||||
set desc = "Hear Ship Ambience Roar"
|
||||
usr.client.prefs.toggles ^= SOUND_SHIP_AMBIENCE
|
||||
usr.client.prefs.save_preferences()
|
||||
|
||||
// STUFF THAT IS "//" NOT REALLY USEFUL
|
||||
if(usr.client.prefs.toggles & SOUND_SHIP_AMBIENCE)
|
||||
//to_chat(usr, "You will now hear ship ambience.")
|
||||
else
|
||||
//to_chat(usr, "You will no longer hear ship ambience.")
|
||||
usr.stop_sound_channel(CHANNEL_BUZZ)
|
||||
|
||||
// Ship ambience check status function
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/Toggle_Ship_Ambience_Get_Checked(client/user_client)
|
||||
return user_client.prefs.toggles & SOUND_SHIP_AMBIENCE
|
||||
|
||||
// Create radial menu
|
||||
/obj/item/clothing/head/helmet/space/deprivation_helmet/proc/populate_helmet_designs()
|
||||
helmet_designs = list(
|
||||
@@ -341,21 +186,11 @@
|
||||
. = ..()
|
||||
if(!(slot & ITEM_SLOT_HEAD))
|
||||
return
|
||||
//Save current sound states
|
||||
var/mob_client = usr.client
|
||||
ambience_sound_state = Toggle_Soundscape_Get_checked(mob_client)
|
||||
instruments_sound_state = Toggle_Instruments_Get_checked(mob_client)
|
||||
combatmode_sound_state = Toggle_Combatmode_Sound_Get_checked(mob_client)
|
||||
midis_sound_state = Toggle_Midis_Get_checked(mob_client)
|
||||
announcement_sound_state = Toggle_Announcement_Sound_Get_checked(mob_client)
|
||||
ship_ambience_sound_state = Toggle_Ship_Ambience_Get_Checked(mob_client)
|
||||
if(muzzle == TRUE)
|
||||
ADD_TRAIT(user, TRAIT_MUTE, CLOTHING_TRAIT)
|
||||
to_chat(usr, span_purple("Something is gagging your mouth! You can barely make a sound..."))
|
||||
if(earmuffs == TRUE)
|
||||
ADD_TRAIT(user, TRAIT_DEAF, CLOTHING_TRAIT)
|
||||
Toggle_Sounds()
|
||||
stop_client_sounds()
|
||||
to_chat(usr, span_purple("You can barely hear anything! Your other senses have become more apparent..."))
|
||||
if(prevent_vision == TRUE)
|
||||
user.become_blind("deprivation_helmet_[REF(src)]")
|
||||
@@ -370,7 +205,6 @@
|
||||
if(earmuffs == TRUE)
|
||||
earmuffs = FALSE
|
||||
REMOVE_TRAIT(user, TRAIT_DEAF, CLOTHING_TRAIT)
|
||||
Toggle_Sounds()
|
||||
earmuffs = TRUE
|
||||
if(prevent_vision == TRUE)
|
||||
user.cure_blind("deprivation_helmet_[REF(src)]")
|
||||
@@ -383,11 +217,3 @@
|
||||
to_chat(user, span_purple("Finally you can hear the world around you once more."))
|
||||
if(prevent_vision == TRUE)
|
||||
to_chat(user, span_purple("The helmet no longer restricts your vision."))
|
||||
|
||||
// Let's drop sound states
|
||||
ambience_sound_state = null
|
||||
instruments_sound_state = null
|
||||
combatmode_sound_state = null
|
||||
midis_sound_state = null
|
||||
announcement_sound_state = null
|
||||
ship_ambience_sound_state = null
|
||||
|
||||
@@ -2821,6 +2821,7 @@
|
||||
#include "code\modules\client\preferences\screentips.dm"
|
||||
#include "code\modules\client\preferences\security_department.dm"
|
||||
#include "code\modules\client\preferences\skin_tone.dm"
|
||||
#include "code\modules\client\preferences\sounds.dm"
|
||||
#include "code\modules\client\preferences\species.dm"
|
||||
#include "code\modules\client\preferences\statpanel.dm"
|
||||
#include "code\modules\client\preferences\tgui.dm"
|
||||
@@ -2840,6 +2841,7 @@
|
||||
#include "code\modules\client\preferences\middleware\random.dm"
|
||||
#include "code\modules\client\preferences\middleware\species.dm"
|
||||
#include "code\modules\client\preferences\migrations\body_type_migration.dm"
|
||||
#include "code\modules\client\preferences\migrations\legacy_sound_toggles_migration.dm"
|
||||
#include "code\modules\client\preferences\migrations\tgui_prefs_migration.dm"
|
||||
#include "code\modules\client\preferences\species_features\basic.dm"
|
||||
#include "code\modules\client\preferences\species_features\ethereal.dm"
|
||||
|
||||
-53
@@ -90,65 +90,12 @@ export const sound_adminhelp: FeatureToggle = {
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_ambience: FeatureToggle = {
|
||||
name: 'Enable ambience',
|
||||
category: 'SOUND',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_announcements: FeatureToggle = {
|
||||
name: 'Enable announcement sounds',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, hear sounds for command reports, notices, etc.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_combatmode: FeatureToggle = {
|
||||
name: 'Enable combat mode sound',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, hear sounds when toggling combat mode.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_endofround: FeatureToggle = {
|
||||
name: 'Enable end of round sounds',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, hear a sound when the server is rebooting.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_instruments: FeatureToggle = {
|
||||
name: 'Enable instruments',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, be able hear instruments in game.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_lobby: FeatureToggle = {
|
||||
name: 'Enable lobby music',
|
||||
category: 'SOUND',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_midi: FeatureToggle = {
|
||||
name: 'Enable admin music',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, admins will be able to play music to you.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_prayers: FeatureToggle = {
|
||||
name: 'Enable prayer sound',
|
||||
category: 'ADMIN',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_ship_ambience: FeatureToggle = {
|
||||
name: 'Enable ship ambience',
|
||||
category: 'SOUND',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const split_admin_tabs: FeatureToggle = {
|
||||
name: 'Split admin tabs',
|
||||
category: 'ADMIN',
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
import { CheckboxInput, FeatureToggle } from '../base';
|
||||
|
||||
export const sound_ambience: FeatureToggle = {
|
||||
name: 'Enable ambience',
|
||||
category: 'SOUND',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_announcements: FeatureToggle = {
|
||||
name: 'Enable announcement sounds',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, hear sounds for command reports, notices, etc.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_combatmode: FeatureToggle = {
|
||||
name: 'Enable combat mode sound',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, hear sounds when toggling combat mode.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_endofround: FeatureToggle = {
|
||||
name: 'Enable end of round sounds',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, hear a sound when the server is rebooting.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_instruments: FeatureToggle = {
|
||||
name: 'Enable instruments',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, be able hear instruments in game.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_jukebox: FeatureToggle = {
|
||||
name: 'Enable jukebox music',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, hear music for jukeboxes, dance machines, etc.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_lobby: FeatureToggle = {
|
||||
name: 'Enable lobby music',
|
||||
category: 'SOUND',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_midi: FeatureToggle = {
|
||||
name: 'Enable admin music',
|
||||
category: 'SOUND',
|
||||
description: 'When enabled, admins will be able to play music to you.',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
|
||||
export const sound_ship_ambience: FeatureToggle = {
|
||||
name: 'Enable ship ambience',
|
||||
category: 'SOUND',
|
||||
component: CheckboxInput,
|
||||
};
|
||||
Reference in New Issue
Block a user