Reworks and Cleans Up Ambience Code (#14652)

* Reworks and Cleans Up Ambience Code

* Removes Unused Defines; Minor Code Comments

* Cleans Up Code Comments

* Changelog

* Changelog Update
This commit is contained in:
SleepyGemmy
2022-08-21 16:25:24 -03:00
committed by GitHub
parent 1f536c64ac
commit 14d7cc6a4d
12 changed files with 171 additions and 182 deletions
+44 -53
View File
@@ -1,24 +1,55 @@
//
// Client Defines
//
/client
parent_type = /datum
////////////////
//ADMIN THINGS//
////////////////
// Admin
var/datum/admins/holder = null
var/datum/admins/deadmin_holder = null
var/buildmode = 0
var/buildmode = 0
///////////////////
//SPAM PROTECTION//
///////////////////
var/last_message = "" //Contains the last message sent by this client - used to protect against copy-paste spamming.
var/last_message_count = 0 //contins a number of how many times a message identical to last_message was sent.
// Spam Protection
var/last_message = "" // Contains the last message sent by this client - used to protect against copy-paste spamming.
var/last_message_count = 0 // Contains a number of how many times a message identical to last_message was sent.
var/last_message_time
var/spam_alert = 0
/////////
//OTHER//
/////////
// Sounds
var/ambient_hum_playing = null // Is the ambient hum playing?
var/ambience_last_played_time = null // "world.time".
// Security
var/info_sent = 0
// comment out the line below when debugging locally to enable the options & messages menu
//control_freak = 1
var/ip_intel = "Disabled"
var/received_discord_pm = -99999
var/discord_admin //IRC- no more IRC, K? Discord admin that spoke with them last.
var/mute_discord = 0
// Database
var/player_age = "Requires database" // So admins know why it isn't working - Used to determine how old the account is - in days.
var/related_accounts_ip = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip
var/related_accounts_cid = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id
var/whitelist_status = 0 //Used to determine what whitelists the player has access to. Uses bitflag values!
var/need_saves_migrated = "Requires database" //Used to determine whether or not the ckey needs their saves migrated over to the database. Default is 0 upon successful connection.
var/account_age = -1 // Age on the BYOND account in days.
var/account_join_date = null // Date of the BYOND account creation in ISO 8601 format.
var/unacked_warning_count = 0
preload_rsc = PRELOAD_RSC
var/authed = TRUE
var/is_initialized = FALSE // Used to track whether the client has been initialized with InitClient.
// Goonchat chat output of the client.
var/datum/chatOutput/chatOutput
// Other
var/datum/preferences/prefs
var/datum/tooltip/tooltips
var/move_delay = 1
@@ -28,44 +59,4 @@
var/time_died_as_rat = 0
var/list/autofire_aiming_at[2]
var/adminhelped = NOT_ADMINHELPED
///////////////
//SOUND STUFF//
///////////////
var/ambience_playing= null
var/played = 0
////////////
//SECURITY//
////////////
var/info_sent = 0
// comment out the line below when debugging locally to enable the options & messages menu
//control_freak = 1
var/ip_intel = "Disabled"
var/received_discord_pm = -99999
var/discord_admin //IRC- no more IRC, K? Discord admin that spoke with them last.
var/mute_discord = 0
////////////////////////////////////
//things that require the database//
////////////////////////////////////
var/player_age = "Requires database" //So admins know why it isn't working - Used to determine how old the account is - in days.
var/related_accounts_ip = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip
var/related_accounts_cid = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id
var/whitelist_status = 0 //Used to determine what whitelists the player has access to. Uses bitflag values!
var/need_saves_migrated = "Requires database" //Used to determine whether or not the ckey needs their saves migrated over to the database. Default is 0 upon successful connection.
var/account_age = -1 // Age on the BYOND account in days.
var/account_join_date = null // Date of the BYOND account creation in ISO 8601 format.
var/unacked_warning_count = 0
preload_rsc = PRELOAD_RSC
var/authed = TRUE
var/is_initialized = FALSE // Used to track whether the client has been initialized with InitClient.
///goonchat chatoutput of the client
var/datum/chatOutput/chatOutput
var/adminhelped = NOT_ADMINHELPED
+71 -67
View File
@@ -1,115 +1,119 @@
// ASFX Toggles List
/var/global/asfx_togs = list(
// /client/proc/Toggle_asfx,
// /client/proc/Toggle_footsteps,
/client/proc/Toggle_asfx_vote,
/client/proc/Toggle_messagesounds,
/client/proc/Toggle_dropsounds,
/client/proc/Toggle_arcadesounds,
/client/proc/Toggle_radiosounds,
/client/proc/Toggle_instrumentsounds
/client/proc/toggle_footsteps,
/client/proc/toggle_asfx_vote,
/client/proc/toggle_messagesounds,
/client/proc/toggle_dropsounds,
/client/proc/toggle_arcadesounds,
/client/proc/toggle_radiosounds,
/client/proc/toggle_instrumentsounds
)
/client/verb/asf_toggle()
set name = "Open ASFX Tab"
// ASFX Tab Toggle
/client/verb/toggle_asfx_tab()
set name = "Toggle SFX Preferences Tab"
set category = "Preferences"
set desc = "Open the ambience sound effects toggle tab"
set desc = "Toggle the SFX preferences tab"
verbs ^= asfx_togs
return
/client/verb/Toggle_asfx() //Allgnew ambience should be added here so it works with this verb until someone better at things comes up with a fix that isn't awful
set name = "Hear/Silence Ambience"
// set category = "SoundFx Prefs"
//
// ASFX Toggles
//
/client/verb/toggle_asfx()
set name = "Toggle Ambience SFX"
set category = "Preferences"
set desc = "Toggles hearing ambient sound effects"
prefs.asfx_togs ^= ASFX_AMBIENCE
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_AMBIENCE)
to_chat(src, "You will now hear ambient sounds.")
to_chat(src, SPAN_INFO("You will now hear ambient sounds."))
else
to_chat(src, "<span class='warning'>You will no longer hear ambient sounds.</span>")
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1)
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2)
feedback_add_details("admin_verb","TSFXAmbi") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
to_chat(src, SPAN_INFO("You will no longer hear ambient sounds."))
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1) // Ambience plays on channel 1.
feedback_add_details("admin_verb", "TSFXAmbi") // If you are copy pasting this, ensure the 2nd parameter is unique to the new proc.
/client/proc/Toggle_footsteps()
set name = "Hear/Silence Footsteps"
set category = "SoundFx Prefs"
/client/verb/toggle_asfx_hum(var/mob/living/L)
set name = "Toggle Ambient Hum SFX"
set category = "Preferences"
set desc = "Toggles hearing the ambient hum sound effect"
prefs.asfx_togs ^= ASFX_HUM
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_HUM)
to_chat(src, SPAN_INFO("You will now hear the ambient hum sound."))
else
to_chat(src, SPAN_INFO("You will no longer hear the ambient hum sound."))
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2) // Ambient hum plays on channel 2.
L.client.ambient_hum_playing = FALSE
feedback_add_details("admin_verb", "TSFXHum")
//
// SFX Toggles
//
/client/proc/toggle_footsteps()
set name = "Toggle Footsteps SFX"
set category = "SFX Preferences"
set desc = "Toggles hearing footstep sound effects"
prefs.asfx_togs ^= ASFX_FOOTSTEPS
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_FOOTSTEPS)
to_chat(src, "You will now hear footstep sounds.")
else
to_chat(src, "<span class='warning'>You will no longer hear footstep sounds.</span>")
feedback_add_details("admin_verb","TSFXFS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
to_chat(src, SPAN_INFO("You will [(prefs.asfx_togs & ASFX_FOOTSTEPS) ? "now" : "no longer"] hear footstep sounds."))
/client/proc/Toggle_asfx_vote()
set name = "Hear/Silence Vote Alarm"
set category = "SoundFx Prefs"
/client/proc/toggle_asfx_vote()
set name = "Toggle Vote Alarm SFX"
set category = "SFX Preferences"
set desc = "Toggles hearing of the vote alarm"
prefs.asfx_togs ^= ASFX_VOTE
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_VOTE)
to_chat(src, "You will now hear the vote alarm.")
else
to_chat(src, "<span class='warning'>You will no longer hear the vote alarm.</span>")
feedback_add_details("admin_verb","TSFXFV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
to_chat(src, SPAN_INFO("You will [(prefs.asfx_togs & ASFX_VOTE) ? "now" : "no longer"] hear the vote alarm."))
/client/proc/Toggle_messagesounds()
/client/proc/toggle_messagesounds()
set name = "Toggle Message SFX"
set category = "SoundFx Prefs"
set desc = "Toggles the message sounds."
set category = "SFX Preferences"
set desc = "Toggles the message sounds"
prefs.asfx_togs ^= ASFX_VOX
prefs.save_preferences()
to_chat(src, "You will [(prefs.asfx_togs & ASFX_VOX) ? "now" : "no longer"] hear chat voices.")
to_chat(src, SPAN_INFO("You will [(prefs.asfx_togs & ASFX_VOX) ? "now" : "no longer"] hear chat voices."))
/client/proc/Toggle_dropsounds()
set name = "Hear/Silence Drop Sounds"
set category = "SoundFx Prefs"
/client/proc/toggle_dropsounds()
set name = "Toggle Item Dropping SFX"
set category = "SFX Preferences"
set desc = "Toggles hearing dropping and throwing sound effects"
prefs.asfx_togs ^= ASFX_DROPSOUND
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_DROPSOUND)
to_chat(src, "You will now hear dropping and throwing sounds.")
else
to_chat(src, "<span class='warning'>You will no longer hear dropping and throwing sounds.</span>")
to_chat(src, SPAN_INFO("You will [(prefs.asfx_togs & ASFX_DROPSOUND) ? "now" : "no longer"] hear dropping and throwing sounds."))
/client/proc/Toggle_arcadesounds()
/client/proc/toggle_arcadesounds()
set name = "Toggle Arcade SFX"
set category = "SoundFx Prefs"
set desc = "Toggles hearing noises made by arcades."
set category = "SFX Preferences"
set desc = "Toggles hearing noises made by arcades"
prefs.asfx_togs ^= ASFX_ARCADE
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_ARCADE)
to_chat(src, "You will now hear arcade sounds.")
else
to_chat(src, "<span class='warning'>You will no longer hear arcade sounds.</span>")
to_chat(src, SPAN_INFO("You will [(prefs.asfx_togs & ASFX_ARCADE) ? "now" : "no longer"] hear arcade sounds."))
/client/proc/Toggle_radiosounds()
/client/proc/toggle_radiosounds()
set name = "Toggle Radio SFX"
set category = "SoundFx Prefs"
set desc = "Toggles hearing noises made by radios."
set category = "SFX Preferences"
set desc = "Toggles hearing noises made by radios"
prefs.asfx_togs ^= ASFX_RADIO
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_RADIO)
to_chat(src, "You will now hear radio sounds.")
else
to_chat(src, "<span class='warning'>You will no longer hear radio sounds.</span>")
to_chat(src, SPAN_INFO("You will [(prefs.asfx_togs & ASFX_RADIO) ? "now" : "no longer"] hear radio sounds."))
/client/proc/Toggle_instrumentsounds()
/client/proc/toggle_instrumentsounds()
set name = "Toggle Instrument SFX"
set category = "SoundFx Prefs"
set desc = "Toggles hearing noises made by instruments."
set category = "SFX Preferences"
set desc = "Toggles hearing noises made by instruments"
prefs.asfx_togs ^= ASFX_INSTRUMENT
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_INSTRUMENT)
to_chat(src, "You will now hear instrument sounds.")
else
to_chat(src, "<span class='warning'>You will no longer hear instrument sounds.</span>")
to_chat(src, SPAN_INFO("You will [(prefs.asfx_togs & ASFX_INSTRUMENT) ? "now" : "no longer"] hear instrument sounds."))
+1 -17
View File
@@ -110,7 +110,6 @@
to_chat(src, "You will [(prefs.toggles & CHAT_OOC) ? "now" : "no longer"] see messages on the OOC channel.")
feedback_add_details("admin_verb","TOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/listen_looc()
set name = "Show/Hide LOOC (All)"
set category = "Preferences"
@@ -145,21 +144,6 @@
to_chat(src, "You will [!(prefs.toggles & CHAT_NOICONS) ? "now" : "no longer"] see chat tag icons.")
feedback_add_details("admin_verb","TCTAG") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/Toggle_Soundscape() //All new ambience should be added here so it works with this verb until someone better at things comes up with a fix that isn't awful
set name = "Hear/Silence Ambience"
set category = "Preferences"
set desc = "Toggles hearing ambient sound effects"
prefs.toggles ^= SOUND_AMBIENCE
prefs.save_preferences()
if(prefs.toggles & SOUND_AMBIENCE)
to_chat(src, "You will now hear ambient sounds.")
else
to_chat(src, "You will no longer hear ambient sounds.")
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1)
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2)
feedback_add_details("admin_verb","TAmbi") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_progress()
set name = "Show/Hide Progress Bars"
set category = "Preferences"
@@ -179,4 +163,4 @@
prefs.toggles_secondary ^= FLOATING_MESSAGES
prefs.save_preferences()
to_chat(src, SPAN_NOTICE("Floating messages are now [prefs.toggles_secondary & FLOATING_MESSAGES ? "enabled" : "disabled"]."))
to_chat(src, SPAN_NOTICE("Floating messages are now [prefs.toggles_secondary & FLOATING_MESSAGES ? "enabled" : "disabled"]."))