Files
Bubberstation/code/modules/mob/dead/observer/observer_say.dm
FeudeyTF 35494b93bb Telecomms Update: Ability to change existing radio channels and create new ones (#91647)
## About The Pull Request
I have added the ability to create and edit station radio channels
through the existing telecommunications system.
You can change the name of the radio channel and its color.

The channel settings are changed and created through the servers
(Frequencies Settings)

![ui](https://github.com/user-attachments/assets/cb010d75-bb00-4e3c-86b6-351b39b832e3)

Here i created my own channel:
1) Add frequency at Receiver (you will not see channel name):

![TestChannelInReceiver](https://github.com/user-attachments/assets/d3934e96-fb2d-492a-a1d6-84e8bfbd6628)
2) Add frequency at Bus (you will not see channel name):

![TestChannelnBus](https://github.com/user-attachments/assets/9955fb9c-9ca0-44f5-8d8f-caf02c0b3a9c)
3) Add frequency at Server
4) Add settings for your frequency

![NewChannel](https://github.com/user-attachments/assets/14a86eae-a000-4106-848b-a140ab678c3c)
5) See the result:

![TestChannel](https://github.com/user-attachments/assets/a720c660-43f6-47c0-8e85-fd313e8ce8d7)

Important Notes:
1) Headsets, radios, and intercoms will not see a change in
telecommunications, but will use standard names (Common, Security etc.).
2) There are still reserved names that cannot be used: CentComm,
Syndicate, Uplink, CTFs channels
3) Servers must filter frequency for applying settings on them

## Why It's Good For The Game

Now telecommunication channels names and colors depends on the settings
of the network servers, which makes it more flexible and logical. It is
also useful for foreign language servers, as you can translate channel
names.

## Changelog

🆑
add: Added ability to change existing radio channels and create new
qol: Added color for some buttons in Telecomms UI
/🆑
2025-06-28 01:19:18 +10:00

82 lines
3.7 KiB
Plaintext

/mob/dead/observer/check_emote(message, forced)
return emote(copytext(message, length(message[1]) + 1), intentional = !forced, force_silence = TRUE)
//Modified version of get_message_mods, removes the trimming, the only thing we care about here is admin channels
/mob/dead/observer/get_message_mods(message, list/mods)
var/key = message[1]
if((key in GLOB.department_radio_prefixes) && length(message) > length(key) + 1 && !mods[RADIO_EXTENSION])
mods[RADIO_KEY] = LOWER_TEXT(message[1 + length(key)])
mods[RADIO_EXTENSION] = GLOB.department_radio_keys[mods[RADIO_KEY]]
return message
/mob/dead/observer/say(
message,
bubble_type,
list/spans = list(),
sanitize = TRUE,
datum/language/language,
ignore_spam = FALSE,
forced,
filterproof = FALSE,
message_range = 7,
datum/saymode/saymode,
list/message_mods = list(),
)
message = trim(message) //trim now and sanitize after checking for special admin radio keys
var/list/filter_result = CAN_BYPASS_FILTER(src) ? null : is_ooc_filtered(message)
if (filter_result)
REPORT_CHAT_FILTER_TO_USER(usr, filter_result)
log_filter("OOC", message, filter_result)
return
var/list/soft_filter_result = CAN_BYPASS_FILTER(src) ? null : is_soft_ooc_filtered(message)
if (soft_filter_result)
if(tgui_alert(usr,"Your message contains \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\". \"[soft_filter_result[CHAT_FILTER_INDEX_REASON]]\", Are you sure you want to say it?", "Soft Blocked Word", list("Yes", "No")) != "Yes")
return
message_admins("[ADMIN_LOOKUPFLW(usr)] has passed the soft filter for \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\" they may be using a disallowed term. Message: \"[message]\"")
log_admin_private("[key_name(usr)] has passed the soft filter for \"[soft_filter_result[CHAT_FILTER_INDEX_WORD]]\" they may be using a disallowed term. Message: \"[message]\"")
if(!message)
return
message = get_message_mods(message, message_mods)
if(client?.holder && (message_mods[RADIO_EXTENSION] == MODE_ADMIN || message_mods[RADIO_EXTENSION] == MODE_DEADMIN || (message_mods[RADIO_EXTENSION] == MODE_PUPPET && mind?.current)))
message = trim_left(copytext_char(message, length(message_mods[RADIO_KEY]) + 2))
switch(message_mods[RADIO_EXTENSION])
if(MODE_ADMIN)
SSadmin_verbs.dynamic_invoke_verb(client, /datum/admin_verb/cmd_admin_say, message)
if(MODE_DEADMIN)
SSadmin_verbs.dynamic_invoke_verb(client, /datum/admin_verb/dsay, message)
if(MODE_PUPPET)
if(!mind.current.say(message))
to_chat(src, span_warning("Your linked body was unable to speak!"))
return
message = copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN)
if(message[1] == "*" && check_emote(message, forced))
return
. = say_dead(message)
/mob/dead/observer/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, radio_freq_name, radio_freq_color, list/spans, list/message_mods = list(), message_range)
. = ..()
var/atom/movable/to_follow = speaker
if(radio_freq)
var/atom/movable/virtualspeaker/V = speaker
if(isAI(V.source))
var/mob/living/silicon/ai/S = V.source
to_follow = S.eyeobj
else
to_follow = V.source
var/link = FOLLOW_LINK(src, to_follow)
// Create map text prior to modifying message for goonchat
if (safe_read_pref(client, /datum/preference/toggle/enable_runechat) && (safe_read_pref(client, /datum/preference/toggle/enable_runechat_non_mobs) || ismob(speaker)))
create_chat_message(speaker, message_language, raw_message, spans)
// Recompose the message, because it's scrambled by default
message = compose_message(speaker, message_language, raw_message, radio_freq, radio_freq_name, radio_freq_color, spans, message_mods)
to_chat(src,
html = "[link] [message]",
avoid_highlighting = speaker == src)
return TRUE