Skip to content

Commit

Permalink
TGS Test Merge (#15961)
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyorange committed Aug 28, 2024
2 parents 915c7ea + fd2840f commit 7ac27b6
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
26 changes: 25 additions & 1 deletion code/game/objects/items/radio/headset.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Defines for TTS modes.
#define HEADSET_TTS_NONE 0
#define HEADSET_TTS_SL_ONLY 1
#define HEADSET_TTS_SQUAD 2
#define HEADSET_TTS_ALL 3

// Used for translating channels to tokens on examination
GLOBAL_LIST_INIT(channel_tokens, list(
RADIO_CHANNEL_REQUISITIONS = RADIO_TOKEN_REQUISITIONS,
Expand Down Expand Up @@ -26,7 +32,8 @@ GLOBAL_LIST_INIT(channel_tokens, list(

equip_slot_flags = ITEM_SLOT_EARS
var/obj/item/encryptionkey/keyslot2 = null

/// Current squad TTS mode the headset is switched to; defaults to no radio TTS
var/squad_tts_mode = HEADSET_TTS_SQUAD

/obj/item/radio/headset/Initialize(mapload)
if(keyslot)
Expand Down Expand Up @@ -156,6 +163,23 @@ GLOBAL_LIST_INIT(channel_tokens, list(
channels[RADIO_CHANNEL_REQUISITIONS] = !channels[RADIO_CHANNEL_REQUISITIONS]
balloon_alert(user, "toggles supply comms [channels[RADIO_CHANNEL_REQUISITIONS] ? "on" : "off"].")

//Toggles TTS mode. If TTS is enabled, we will play TTS for any radio messages passed through the headset.
/obj/item/radio/headset/RightClick(mob/user)
. = ..()
switch(squad_tts_mode)
if(HEADSET_TTS_NONE)
user.balloon_alert(user, "You switch the TTS mode to \"SL Only\"")
squad_tts_mode = HEADSET_TTS_SL_ONLY
if(HEADSET_TTS_SL_ONLY)
user.balloon_alert(user, "You switch the TTS mode to \"Squad\"")
squad_tts_mode = HEADSET_TTS_SQUAD
if(HEADSET_TTS_SQUAD)
user.balloon_alert(user, "You switch the TTS mode to \"All\"")
squad_tts_mode = HEADSET_TTS_ALL
if(HEADSET_TTS_ALL)
user.balloon_alert(user, "You switch the TTS mode to \"None\"")
squad_tts_mode = HEADSET_TTS_NONE

/obj/item/radio/headset/vendor_equip(mob/user)
..()
return user.equip_to_appropriate_slot(src)
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/machinery/overwatch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -986,17 +986,17 @@ GLOBAL_LIST_EMPTY(active_cas_targets)
switch(command_aura)
if("move")
var/image/move = image('icons/mob/talk.dmi', src, icon_state = "order_move")
message = pick(";GET MOVING!", ";GO, GO, GO!", ";WE ARE ON THE MOVE!", ";MOVE IT!", ";DOUBLE TIME!", ";ONWARDS!", ";MOVE MOVE MOVE!", ";ON YOUR FEET!", ";GET A MOVE ON!", ";ON THE DOUBLE!", ";ROLL OUT!", ";LET'S GO, LET'S GO!", ";MOVE OUT!", ";LEAD THE WAY!", ";FORWARD!", ";COME ON, MOVE!", ";HURRY, GO!")
message = pick("GET MOVING!", "GO, GO, GO!", "WE ARE ON THE MOVE!", "MOVE IT!", "DOUBLE TIME!", "ONWARDS!", "MOVE MOVE MOVE!", "ON YOUR FEET!", "GET A MOVE ON!", "ON THE DOUBLE!", "ROLL OUT!", "LET'S GO, LET'S GO!", "MOVE OUT!", "LEAD THE WAY!", "FORWARD!", "COME ON, MOVE!", "HURRY, GO!")
say(message)
add_emote_overlay(move)
if("hold")
var/image/hold = image('icons/mob/talk.dmi', src, icon_state = "order_hold")
message = pick(";DUCK AND COVER!", ";HOLD THE LINE!", ";HOLD POSITION!", ";STAND YOUR GROUND!", ";STAND AND FIGHT!", ";TAKE COVER!", ";COVER THE AREA!", ";BRACE FOR COVER!", ";BRACE!", ";INCOMING!")
message = pick("DUCK AND COVER!", "HOLD THE LINE!", "HOLD POSITION!", "STAND YOUR GROUND!", "STAND AND FIGHT!", "TAKE COVER!", "COVER THE AREA!", "BRACE FOR COVER!", "BRACE!", "INCOMING!")
say(message)
add_emote_overlay(hold)
if("focus")
var/image/focus = image('icons/mob/talk.dmi', src, icon_state = "order_focus")
message = pick(";FOCUS FIRE!", ";PICK YOUR TARGETS!", ";CENTER MASS!", ";CONTROLLED BURSTS!", ";AIM YOUR SHOTS!", ";READY WEAPONS!", ";TAKE AIM!", ";LINE YOUR SIGHTS!", ";LOCK AND LOAD!", ";GET READY TO FIRE!")
message = pick("FOCUS FIRE!", "PICK YOUR TARGETS!", "CENTER MASS!", "CONTROLLED BURSTS!", "AIM YOUR SHOTS!", "READY WEAPONS!", "TAKE AIM!", "LINE YOUR SIGHTS!", "LOCK AND LOAD!", "GET READY TO FIRE!")
say(message)
add_emote_overlay(focus)

Expand Down
38 changes: 38 additions & 0 deletions code/game/objects/machinery/telecomms/broadcasting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,44 @@
continue
hearer.Hear(rendered, virt, language, message, frequency, spans)


//Check that speaker isn't banned from TTS
var/atom/movable/speaker = virt?.source
var/banned = FALSE
if(ismob(speaker))
var/mob/potential_user = speaker
if(is_banned_from(potential_user.ckey, "TTS") || potential_user.client?.prefs.muted & MUTE_TTS)
banned = TRUE

//If they aren't, handle radio TTS
if(speaker && speaker.voice && !banned)
var/is_speaker_squad_lead = FALSE
if(ishuman(speaker))
var/mob/living/carbon/human/human_speaker = speaker
if(human_speaker.assigned_squad?.squad_leader == speaker)
is_speaker_squad_lead = TRUE

if(speaker in receive)
receive -= speaker //This list isn't used again, so we can just cut out the original speaker from it so TTS doesn't play twice

for(var/mob/living/carbon/human/potential_hearer in receive)
if(potential_hearer.stat >= UNCONSCIOUS || potential_hearer.disabilities & DEAF || !(potential_hearer.client?.prefs.sound_tts != TTS_SOUND_OFF))
continue

var/obj/item/radio/headset/radio = potential_hearer.wear_ear
switch(radio.squad_tts_mode)
if(HEADSET_TTS_NONE)
continue
if(HEADSET_TTS_SQUAD)
if(potential_hearer.assigned_squad?.radio_freq != frequency)
continue
if(HEADSET_TTS_SL_ONLY)
if(potential_hearer.assigned_squad?.radio_freq != frequency || !is_speaker_squad_lead)
continue

INVOKE_ASYNC(SStts, TYPE_PROC_REF(/datum/controller/subsystem/tts, queue_tts_message), potential_hearer, html_decode(message), language, speaker.voice, potential_hearer.voice_filter, local = TRUE, pitch = speaker.pitch, special_filters = TTS_FILTER_RADIO)


var/spans_part = ""
if(length(spans))
spans_part = "(spans:"
Expand Down

0 comments on commit 7ac27b6

Please sign in to comment.