mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Radio headset sounds (#32402)
* Radio headset sounds * SQL stuff * wtf * typo * fixed db Co-authored-by: Damian <damian@autistici.org>
This commit is contained in:
@@ -121,6 +121,7 @@ CREATE TABLE client (
|
|||||||
hear_instruments INTEGER,
|
hear_instruments INTEGER,
|
||||||
ambience_volume INTEGER,
|
ambience_volume INTEGER,
|
||||||
credits_volume INTEGER,
|
credits_volume INTEGER,
|
||||||
|
headset_sound INTEGER,
|
||||||
antag_objectives INTEGER,
|
antag_objectives INTEGER,
|
||||||
typing_indicator INTEGER,
|
typing_indicator INTEGER,
|
||||||
mob_chat_on_map INTEGER,
|
mob_chat_on_map INTEGER,
|
||||||
|
|||||||
@@ -14,3 +14,8 @@
|
|||||||
#define JOB_PREF_MED 2
|
#define JOB_PREF_MED 2
|
||||||
#define JOB_PREF_LOW 1
|
#define JOB_PREF_LOW 1
|
||||||
#define JOB_PREF_NEVER 0
|
#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
|
||||||
@@ -34,12 +34,16 @@
|
|||||||
/obj/item/device/radio/headset/talk_into(datum/speech/speech_orig, channel=null)
|
/obj/item/device/radio/headset/talk_into(datum/speech/speech_orig, channel=null)
|
||||||
if(!broadcasting)
|
if(!broadcasting)
|
||||||
return
|
return
|
||||||
|
if(usr.client && usr.client.prefs.headset_sound)
|
||||||
|
playsound(usr, 'sound/effects/radio_chatter.ogg', 100, 1, vary = 0)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/item/device/radio/headset/receive_range(freq, level)
|
/obj/item/device/radio/headset/receive_range(freq, level)
|
||||||
if(ishuman(src.loc))
|
if(ishuman(src.loc))
|
||||||
var/mob/living/carbon/human/H = src.loc
|
var/mob/living/carbon/human/H = src.loc
|
||||||
if(H.ears == src)
|
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 ..(freq, level)
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,12 @@ var/list/special_popup_text2num = list(
|
|||||||
"Use both chat and special" = SPECIAL_POPUP_USE_BOTH,
|
"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
|
var/const/MAX_SAVE_SLOTS = 16
|
||||||
|
|
||||||
#define POLLED_LIMIT 100
|
#define POLLED_LIMIT 100
|
||||||
@@ -204,6 +210,9 @@ var/const/MAX_SAVE_SLOTS = 16
|
|||||||
// Whether or not to use randomized character slots
|
// Whether or not to use randomized character slots
|
||||||
var/randomslot = 0
|
var/randomslot = 0
|
||||||
|
|
||||||
|
// Radio headset static sound
|
||||||
|
var/headset_sound = HEADSET_SOUND_TRANSMIT
|
||||||
|
|
||||||
// jukebox volume
|
// jukebox volume
|
||||||
var/volume = 100
|
var/volume = 100
|
||||||
var/usewmp = 0 //whether to use WMP or VLC
|
var/usewmp = 0 //whether to use WMP or VLC
|
||||||
@@ -383,6 +392,8 @@ var/const/MAX_SAVE_SLOTS = 16
|
|||||||
<a href='?_src_=prefs;preference=ambience'><b>[(toggles & SOUND_AMBIENCE) ? "Yes" : "No"]</b></a><br>
|
<a href='?_src_=prefs;preference=ambience'><b>[(toggles & SOUND_AMBIENCE) ? "Yes" : "No"]</b></a><br>
|
||||||
[(toggles & SOUND_AMBIENCE)? \
|
[(toggles & SOUND_AMBIENCE)? \
|
||||||
"<b>Ambience Volume:</b><a href='?_src_=prefs;preference=ambience_volume'><b>[ambience_volume]</b></a><br>":""]
|
"<b>Ambience Volume:</b><a href='?_src_=prefs;preference=ambience_volume'><b>[ambience_volume]</b></a><br>":""]
|
||||||
|
<b>Radio Headset Sounds:</b>
|
||||||
|
<a href='?_src_=prefs;preference=headset_sound'><b>[headset_sound_text2num[headset_sound+1]]</b></a><br>
|
||||||
<b>Hear streamed media:</b>
|
<b>Hear streamed media:</b>
|
||||||
<a href='?_src_=prefs;preference=jukebox'><b>[(toggles & SOUND_STREAMING) ? "Yes" : "No"]</b></a><br>
|
<a href='?_src_=prefs;preference=jukebox'><b>[(toggles & SOUND_STREAMING) ? "Yes" : "No"]</b></a><br>
|
||||||
<b>Streaming Program:</b>
|
<b>Streaming Program:</b>
|
||||||
@@ -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)
|
user << sound(null, repeat = 0, wait = 0, volume = 0, channel = CHANNEL_AMBIENCE)
|
||||||
if("ambience_volume")
|
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)
|
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")
|
if("jukebox")
|
||||||
toggles ^= SOUND_STREAMING
|
toggles ^= SOUND_STREAMING
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
hear_voicesound = text2num(preference_list_client["hear_voicesound"])
|
hear_voicesound = text2num(preference_list_client["hear_voicesound"])
|
||||||
hear_instruments = text2num(preference_list_client["hear_instruments"])
|
hear_instruments = text2num(preference_list_client["hear_instruments"])
|
||||||
ambience_volume = text2num(preference_list_client["ambience_volume"])
|
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_volume = text2num(preference_list_client["credits_volume"])
|
||||||
credits = preference_list_client["credits"]
|
credits = preference_list_client["credits"]
|
||||||
jingle = preference_list_client["jingle"]
|
jingle = preference_list_client["jingle"]
|
||||||
@@ -102,6 +103,7 @@
|
|||||||
hear_voicesound = sanitize_integer(hear_voicesound, 0, 1, initial(hear_voicesound))
|
hear_voicesound = sanitize_integer(hear_voicesound, 0, 1, initial(hear_voicesound))
|
||||||
hear_instruments = sanitize_integer(hear_instruments, 0, 1, initial(hear_instruments))
|
hear_instruments = sanitize_integer(hear_instruments, 0, 1, initial(hear_instruments))
|
||||||
ambience_volume = sanitize_integer(ambience_volume, 0, 100, initial(ambience_volume))
|
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))
|
credits_volume = sanitize_integer(credits_volume, 0, 100, initial(credits_volume))
|
||||||
window_flashing = sanitize_integer(window_flashing, 0, 1, initial(window_flashing))
|
window_flashing = sanitize_integer(window_flashing, 0, 1, initial(window_flashing))
|
||||||
antag_objectives = sanitize_integer(antag_objectives, 0, 1, initial(antag_objectives))
|
antag_objectives = sanitize_integer(antag_objectives, 0, 1, initial(antag_objectives))
|
||||||
@@ -133,15 +135,15 @@
|
|||||||
check.Add("SELECT ckey FROM client WHERE ckey = ?", ckey)
|
check.Add("SELECT ckey FROM client WHERE ckey = ?", ckey)
|
||||||
if(check.Execute(db))
|
if(check.Execute(db))
|
||||||
if(!check.NextRow())
|
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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",\
|
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, 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, 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))
|
if(!q.Execute(db))
|
||||||
message_admins("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #: [q.Error()] - [q.ErrorMsg()]")
|
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()]")
|
WARNING("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #:[q.Error()] - [q.ErrorMsg()]")
|
||||||
return 0
|
return 0
|
||||||
else
|
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 = ?",\
|
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, 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)
|
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))
|
if(!q.Execute(db))
|
||||||
message_admins("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #: [q.Error()] - [q.ErrorMsg()]")
|
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()]")
|
WARNING("Error in save_preferences_sqlite [__FILE__] ln:[__LINE__] #:[q.Error()] - [q.ErrorMsg()]")
|
||||||
|
|||||||
13
code/modules/migrations/SS13_Prefs/028-headset-sounds.dm
Normal file
13
code/modules/migrations/SS13_Prefs/028-headset-sounds.dm
Normal file
@@ -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
|
||||||
BIN
sound/effects/radio_chatter.ogg
Normal file
BIN
sound/effects/radio_chatter.ogg
Normal file
Binary file not shown.
@@ -1758,6 +1758,7 @@
|
|||||||
#include "code\modules\migrations\SS13_Prefs\025-warning_notif.dm"
|
#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\026-add-fps.dm"
|
||||||
#include "code\modules\migrations\SS13_Prefs\027-refactor-jobs.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\migrations\SS13_Prefs\_base.dm"
|
||||||
#include "code\modules\mining\abandonedcrates.dm"
|
#include "code\modules\mining\abandonedcrates.dm"
|
||||||
#include "code\modules\mining\debug_shit.dm"
|
#include "code\modules\mining\debug_shit.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user