diff --git a/SQL/players2.sql b/SQL/players2.sql index ffb97917fd2..dee35b142e1 100644 --- a/SQL/players2.sql +++ b/SQL/players2.sql @@ -121,6 +121,7 @@ CREATE TABLE client ( hear_instruments INTEGER, ambience_volume INTEGER, credits_volume INTEGER, + headset_sound INTEGER, antag_objectives INTEGER, typing_indicator INTEGER, mob_chat_on_map INTEGER, diff --git a/__DEFINES/preferences.dm b/__DEFINES/preferences.dm index 54c050b336f..90c4538d29f 100644 --- a/__DEFINES/preferences.dm +++ b/__DEFINES/preferences.dm @@ -14,3 +14,8 @@ #define JOB_PREF_MED 2 #define JOB_PREF_LOW 1 #define JOB_PREF_NEVER 0 + +// /datum/preferences/var/headset_sound +#define HEADSET_SOUND_DISABLED 0 +#define HEADSET_SOUND_TRANSMIT 1 +#define HEADSET_SOUND_ALL 2 \ No newline at end of file diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 1267e8f825c..ef576362031 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -34,12 +34,16 @@ /obj/item/device/radio/headset/talk_into(datum/speech/speech_orig, channel=null) if(!broadcasting) return + if(usr.client && usr.client.prefs.headset_sound) + playsound(usr, 'sound/effects/radio_chatter.ogg', 100, 1, vary = 0) return ..() /obj/item/device/radio/headset/receive_range(freq, level) if(ishuman(src.loc)) var/mob/living/carbon/human/H = src.loc if(H.ears == src) + if(H.client && (H.client.prefs.headset_sound == HEADSET_SOUND_ALL)) + playsound(H, 'sound/effects/radio_chatter.ogg', 100, 1, vary = 0) return ..(freq, level) return -1 diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index bc8631a8a41..91faad8c7d6 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -93,6 +93,12 @@ var/list/special_popup_text2num = list( "Use both chat and special" = SPECIAL_POPUP_USE_BOTH, ) +var/list/headset_sound_text2num = list( + "Disabled" = HEADSET_SOUND_DISABLED, + "Transmit Only" = HEADSET_SOUND_TRANSMIT, + "All" = HEADSET_SOUND_ALL, +) + var/const/MAX_SAVE_SLOTS = 16 #define POLLED_LIMIT 100 @@ -204,6 +210,9 @@ var/const/MAX_SAVE_SLOTS = 16 // Whether or not to use randomized character slots var/randomslot = 0 + // Radio headset static sound + var/headset_sound = HEADSET_SOUND_TRANSMIT + // jukebox volume var/volume = 100 var/usewmp = 0 //whether to use WMP or VLC @@ -383,6 +392,8 @@ var/const/MAX_SAVE_SLOTS = 16 [(toggles & SOUND_AMBIENCE) ? "Yes" : "No"]
[(toggles & SOUND_AMBIENCE)? \ "Ambience Volume:[ambience_volume]
":""] + Radio Headset Sounds: + [headset_sound_text2num[headset_sound+1]]
Hear streamed media: [(toggles & SOUND_STREAMING) ? "Yes" : "No"]
Streaming Program: @@ -1254,6 +1265,12 @@ Values up to 1000 are allowed.", "FPS", fps) as null|num user << sound(null, repeat = 0, wait = 0, volume = 0, channel = CHANNEL_AMBIENCE) if("ambience_volume") ambience_volume = min(max(input(user, "Enter the new volume you wish to use. (0-100)","Ambience Volume Preferences", ambience_volume), 0), 100) + + if("headset_sound") + var/choice = input(user, "Set your radio headset sound preferences:", "Settings") as null|anything in headset_sound_text2num + if(!isnull(choice)) + headset_sound = headset_sound_text2num[choice] + if("jukebox") toggles ^= SOUND_STREAMING diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 94842cd71c3..04c864fd179 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -61,6 +61,7 @@ hear_voicesound = text2num(preference_list_client["hear_voicesound"]) hear_instruments = text2num(preference_list_client["hear_instruments"]) ambience_volume = text2num(preference_list_client["ambience_volume"]) + headset_sound = text2num(preference_list_client["headset_sound"]) credits_volume = text2num(preference_list_client["credits_volume"]) credits = preference_list_client["credits"] jingle = preference_list_client["jingle"] @@ -102,6 +103,7 @@ hear_voicesound = sanitize_integer(hear_voicesound, 0, 1, initial(hear_voicesound)) hear_instruments = sanitize_integer(hear_instruments, 0, 1, initial(hear_instruments)) ambience_volume = sanitize_integer(ambience_volume, 0, 100, initial(ambience_volume)) + headset_sound = sanitize_integer(headset_sound, 0, 2, initial(headset_sound)) credits_volume = sanitize_integer(credits_volume, 0, 100, initial(credits_volume)) window_flashing = sanitize_integer(window_flashing, 0, 1, initial(window_flashing)) antag_objectives = sanitize_integer(antag_objectives, 0, 1, initial(antag_objectives)) @@ -133,15 +135,15 @@ check.Add("SELECT ckey FROM client WHERE ckey = ?", ckey) if(check.Execute(db)) if(!check.NextRow()) - q.Add("INSERT into client (ckey, ooc_color, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map, no_goonchat_for_obj, tgui_fancy, show_warning_next_time, last_warned_message, warning_admin, fps) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",\ - ckey, ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special_popup, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map, no_goonchat_for_obj, tgui_fancy, show_warning_next_time, last_warned_message, warning_admin, fps) + q.Add("INSERT into client (ckey, ooc_color, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, headset_sound, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map, no_goonchat_for_obj, tgui_fancy, show_warning_next_time, last_warned_message, warning_admin, fps) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",\ + ckey, ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special_popup, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, headset_sound, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map, no_goonchat_for_obj, tgui_fancy, show_warning_next_time, last_warned_message, warning_admin, fps) if(!q.Execute(db)) message_admins("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #: [q.Error()] - [q.ErrorMsg()]") WARNING("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #:[q.Error()] - [q.ErrorMsg()]") return 0 else - q.Add("UPDATE client SET ooc_color=?,lastchangelog=?,UI_style=?,default_slot=?,toggles=?,UI_style_color=?,UI_style_alpha=?,warns=?,warnbans=?,randomslot=?,volume=?,usewmp=?,special=?,usenanoui=?,tooltips=?,progress_bars=?,space_parallax=?,space_dust=?,parallax_speed=?, stumble=?, attack_animation=?, pulltoggle=?, credits=?, jingle=?, hear_voicesound=?, hear_instruments=?, ambience_volume=?, credits_volume=?, window_flashing=?, antag_objectives=? , typing_indicator=? , mob_chat_on_map=? , max_chat_length=?, obj_chat_on_map=?, no_goonchat_for_obj=?, tgui_fancy=?, show_warning_next_time=?, last_warned_message=?, warning_admin=?, fps=? WHERE ckey = ?",\ - ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special_popup, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map,no_goonchat_for_obj, tgui_fancy, show_warning_next_time, last_warned_message, warning_admin, fps, ckey) + q.Add("UPDATE client SET ooc_color=?,lastchangelog=?,UI_style=?,default_slot=?,toggles=?,UI_style_color=?,UI_style_alpha=?,warns=?,warnbans=?,randomslot=?,volume=?,usewmp=?,special=?,usenanoui=?,tooltips=?,progress_bars=?,space_parallax=?,space_dust=?,parallax_speed=?, stumble=?, attack_animation=?, pulltoggle=?, credits=?, jingle=?, hear_voicesound=?, hear_instruments=?, ambience_volume=?, headset_sound=?, credits_volume=?, window_flashing=?, antag_objectives=? , typing_indicator=? , mob_chat_on_map=? , max_chat_length=?, obj_chat_on_map=?, no_goonchat_for_obj=?, tgui_fancy=?, show_warning_next_time=?, last_warned_message=?, warning_admin=?, fps=? WHERE ckey = ?",\ + ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, warns, warnbans, randomslot, volume, usewmp, special_popup, usenanoui, tooltips, progress_bars, space_parallax, space_dust, parallax_speed, stumble, attack_animation, pulltoggle, credits, jingle, hear_voicesound, hear_instruments, ambience_volume, headset_sound, credits_volume, window_flashing, antag_objectives, typing_indicator, mob_chat_on_map, max_chat_length, obj_chat_on_map,no_goonchat_for_obj, tgui_fancy, show_warning_next_time, last_warned_message, warning_admin, fps, ckey) if(!q.Execute(db)) message_admins("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #: [q.Error()] - [q.ErrorMsg()]") WARNING("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #:[q.Error()] - [q.ErrorMsg()]") diff --git a/code/modules/migrations/SS13_Prefs/028-headset-sounds.dm b/code/modules/migrations/SS13_Prefs/028-headset-sounds.dm new file mode 100644 index 00000000000..31d7bb21c35 --- /dev/null +++ b/code/modules/migrations/SS13_Prefs/028-headset-sounds.dm @@ -0,0 +1,13 @@ +/datum/migration/sqlite/ss13_prefs/_028 + id = 28 + name = "Headset Sounds" + +/datum/migration/sqlite/ss13_prefs/_028/up() + if(!hasColumn("client", "headset_sound")) + return execute("ALTER TABLE `client` ADD COLUMN headset_sound") + return TRUE + +/datum/migration/sqlite/ss13_prefs/_028/down() + if(hasColumn("client", "headset_sound")) + return execute("ALTER TABLE `client` DROP COLUMN headset_sound") + return TRUE diff --git a/sound/effects/radio_chatter.ogg b/sound/effects/radio_chatter.ogg new file mode 100644 index 00000000000..6e5b3ecfbfe Binary files /dev/null and b/sound/effects/radio_chatter.ogg differ diff --git a/vgstation13.dme b/vgstation13.dme index 85922ec86e4..8ec8c2352b9 100644 --- a/vgstation13.dme +++ b/vgstation13.dme @@ -1758,6 +1758,7 @@ #include "code\modules\migrations\SS13_Prefs\025-warning_notif.dm" #include "code\modules\migrations\SS13_Prefs\026-add-fps.dm" #include "code\modules\migrations\SS13_Prefs\027-refactor-jobs.dm" +#include "code\modules\migrations\SS13_Prefs\028-headset-sounds.dm" #include "code\modules\migrations\SS13_Prefs\_base.dm" #include "code\modules\mining\abandonedcrates.dm" #include "code\modules\mining\debug_shit.dm"