Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radio crackle QoL #3902

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define SHOW_BEHIND_LARGE_ICONS_1 (1<<12)
/// Should we use the initial icon for display? Mostly used by overlay only objects
#define HTML_USE_INITAL_ICON_1 (1<<20)
// Whether or not this atom is storing contents for a disassociated storage object
#define HAS_DISASSOCIATED_STORAGE_1 (1<<24)

// Update flags for [/atom/proc/update_appearance]
/// Update the atom's name
Expand Down
7 changes: 4 additions & 3 deletions code/__DEFINES/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
#define DEADMIN_POSITION_SECURITY (1<<18)
#define DEADMIN_POSITION_SILICON (1<<19)
#define SOUND_ENDOFROUND (1<<20)
#define SPLIT_ADMIN_TABS (1<<22)
#define FAST_MC_REFRESH (1<<23)
#define SPLIT_ADMIN_TABS (1<<21)
#define FAST_MC_REFRESH (1<<22)
#define SOUND_RADIO (1<<23)

#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_ENDOFROUND|MEMBER_PUBLIC|INTENT_STYLE|MIDROUND_ANTAG|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS)
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_ENDOFROUND|SOUND_RADIO|MEMBER_PUBLIC|INTENT_STYLE|MIDROUND_ANTAG|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS)

//Chat toggles
#define CHAT_OOC (1<<0)
Expand Down
4 changes: 0 additions & 4 deletions code/game/machinery/telecomms/broadcasting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,8 @@
if(R.independent && R.can_receive(frequency, map_zones))
radios += R

//WS edit begin - Radio chatter #434
// Next, we'll have each radio play a small sound effect except for the one that broadcasted it.
for(var/obj/item/radio/radio in radios)
if(radio.last_chatter_time + 1 SECONDS < world.time && source != radio)
playsound(radio, "sound/effects/radio_chatter.ogg", 20, FALSE)
radio.last_chatter_time = world.time
if(radio.log)
var/name = data["name"]
var/list/log_details = list()
Expand Down
9 changes: 1 addition & 8 deletions code/game/objects/items/devices/radio/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
var/emped = 0
///It can be used for hotkeys
var/headset = FALSE
///The time since we last played a radio chatter sound.
var/last_chatter_time

///Whether the radio will transmit dialogue it hears nearby.
var/broadcasting = FALSE
///Whether the radio is currently receiving.
Expand Down Expand Up @@ -274,20 +271,16 @@
var/datum/signal/subspace/vocal/signal = new(src, freq, speaker, language, message, spans, message_mods)

// Independent radios, on the CentCom frequency, reach all independent radios
if (independent && (freq == FREQ_CENTCOM || freq == FREQ_WIDEBAND)) //WS Edit - SolGov Rep
if (independent && (freq == FREQ_CENTCOM || freq == FREQ_WIDEBAND))
signal.data["compression"] = 0
signal.transmission_method = TRANSMISSION_SUPERSPACE
signal.map_zones = list(0) // reaches all Z-levels
signal.broadcast()
playsound(src, "sound/effects/walkietalkie.ogg", 20, FALSE) //WS Edit - Radio chatter
return

// All radios make an attempt to use the subspace system first
signal.send_to_receivers()

//At this point the signal was transmitted so play a sound //WS Edit - Radio chatter
playsound(src, "sound/effects/walkietalkie.ogg", 20, FALSE) //WS Edit - Radio chatter

// If the radio is subspace-only, that's all it can do
if (subspace_transmission)
return
Expand Down
17 changes: 16 additions & 1 deletion code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 41
#define SAVEFILE_VERSION_MAX 42

/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
Expand Down Expand Up @@ -76,9 +76,24 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(current_version < 38)
outline_enabled = TRUE
outline_color = COLOR_BLUE_GRAY

if (current_version < 40)
LAZYADD(key_bindings["Space"], "hold_throw_mode")

if(current_version < 42)
//The toggles defines were moved down one bit
if(toggles & FAST_MC_REFRESH)
toggles |= SPLIT_ADMIN_TABS
else
toggles &= ~SPLIT_ADMIN_TABS

if(toggles & SOUND_RADIO)
toggles |= FAST_MC_REFRESH
else
toggles &= ~FAST_MC_REFRESH

toggles |= SOUND_RADIO

/datum/preferences/proc/update_character(current_version, savefile/S)
if(current_version < 39)
var/species_id
Expand Down
3 changes: 1 addition & 2 deletions code/modules/client/preferences_toggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggle_announcement_sound)()
/datum/verbs/menu/Settings/Sound/toggle_announcement_sound/Get_checked(client/C)
return C.prefs.toggles & SOUND_ANNOUNCEMENTS

/* READD THIS WHEN YOU FIX RADIO CHATTER
//Readded, now that radio chatter is fixed.
TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggle_radio_sound)()
set name = "Hear/Silence Radio Chatter"
set category = "Preferences"
Expand All @@ -260,7 +260,6 @@ TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggle_radio_sound)()

/datum/verbs/menu/Settings/Sound/toggle_radio_sound/Get_checked(client/C)
return C.prefs.toggles & SOUND_RADIO
*/

/datum/verbs/menu/Settings/Sound/verb/stop_client_sounds()
set name = "Stop Sounds"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/living_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@
var/body_pixel_x_offset = 0
///Default Y offset
var/body_pixel_y_offset = 0

/// World time of the last time this mob heard a radio crackle, to reduce spamminess.
COOLDOWN_DECLARE(radio_crackle_cooldown)
13 changes: 12 additions & 1 deletion code/modules/mob/living/living_say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,25 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
deaf_type = 2 // Since you should be able to hear yourself without looking

// Create map text prior to modifying message for goonchat
if (client?.prefs.chat_on_map && !(stat == UNCONSCIOUS || stat == HARD_CRIT) && (client.prefs.see_chat_non_mob || ismob(speaker)) && can_hear())
if(client?.prefs.chat_on_map && !(stat == UNCONSCIOUS || stat == HARD_CRIT) && (client.prefs.see_chat_non_mob || ismob(speaker)) && can_hear())
if(message_mods[MODE_WHISPER] == MODE_WHISPER_CRIT)
play_screen_text("<i>message</i>")
if(message_mods[MODE_CUSTOM_SAY_ERASE_INPUT])
create_chat_message(speaker, null, message_mods[MODE_CUSTOM_SAY_EMOTE], spans, EMOTE_MESSAGE)
else
create_chat_message(speaker, message_language, raw_message, spans)

if(radio_freq && (client?.prefs.toggles & SOUND_RADIO))
//All calls to hear that include radio_freq will be from radios, so we can assume that the speaker is a virtualspeaker
var/atom/movable/virtualspeaker/virt = speaker
//Play the walkie sound if this mob is speaking, and don't apply cooldown
if(virt.source == src)
playsound_local(get_turf(speaker), "sound/effects/walkietalkie.ogg", 20, FALSE)
else if(COOLDOWN_FINISHED(src, radio_crackle_cooldown))
playsound_local(get_turf(speaker), "sound/effects/radio_chatter.ogg", 20, FALSE)
//Always start it so that it only crackles when there hasn't been a message in a while
COOLDOWN_START(src, radio_crackle_cooldown, 5 SECONDS)

// Recompose message for AI hrefs, language incomprehension.
message = compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mods)

Expand Down
Loading