From 217c52c890c67d33d7210e69f54ce4b7f2bb2e8c Mon Sep 17 00:00:00 2001 From: Gaxeer <44334376+Gaxeer@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:22:38 +0200 Subject: [PATCH] Radio examine qol (#89028) ## About The Pull Request Add `span_class` macro to use instead of (now only used for changes I made to radio examine). Make radio channel tokens info from headset examine more readable by color coding and displaying it in list format. Currently set broadcast frequence is also color coded and bold. ## Why It's Good For The Game It's now easier to understand headset examine info :D
Before ![image](https://github.com/user-attachments/assets/6b5d7533-6b8e-47b9-9cd2-7c7a92552ca2) ![image](https://github.com/user-attachments/assets/7fcbde2b-0817-4db6-aca8-d15c17d708be)
After ![image](https://github.com/user-attachments/assets/6e9a7156-9c76-4843-8a45-7fce752a7b27) ![image](https://github.com/user-attachments/assets/50e5fb70-eb18-4fc5-803a-070774c73ccf)
## Changelog :cl: qol: tokens and channel names in radio headset examine are now color coded and display in list format qol: broadcast frequency in examine is also color coded code: add new `span_class` macro /:cl: --- code/__DEFINES/span.dm | 3 ++ .../objects/items/devices/radio/headset.dm | 40 +++++++++++-------- .../game/objects/items/devices/radio/radio.dm | 2 +- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/code/__DEFINES/span.dm b/code/__DEFINES/span.dm index d1077823858..18ce0a96a71 100644 --- a/code/__DEFINES/span.dm +++ b/code/__DEFINES/span.dm @@ -1,3 +1,6 @@ +// Just a generic span with class +#define span_class(class, str) ("" + str + "") + // Sorted alphabetically #define span_abductor(str) ("" + str + "") #define span_admin(str) ("" + str + "") diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 8ad4f0d77d1..578c671bf53 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -47,23 +47,31 @@ GLOBAL_LIST_INIT(channel_tokens, list( /obj/item/radio/headset/examine(mob/user) . = ..() - if(item_flags & IN_INVENTORY && loc == user) - // construction of frequency description - var/list/avail_chans = list("Use [RADIO_KEY_COMMON] for the currently tuned frequency") - if(special_channels & RADIO_SPECIAL_BINARY) - avail_chans += "use [MODE_TOKEN_BINARY] for [MODE_BINARY]" - if(length(channels)) - for(var/i in 1 to length(channels)) - if(i == 1) - avail_chans += "use [MODE_TOKEN_DEPARTMENT] or [GLOB.channel_tokens[channels[i]]] for [LOWER_TEXT(channels[i])]" - else - avail_chans += "use [GLOB.channel_tokens[channels[i]]] for [LOWER_TEXT(channels[i])]" - . += span_notice("A small screen on the headset displays the following available frequencies:\n[english_list(avail_chans)].") - - if(command) - . += span_info("Alt-click to toggle the high-volume mode.") - else + if(!(item_flags & IN_INVENTORY) || loc != user) . += span_notice("A small screen on the headset flashes, it's too small to read without holding or wearing the headset.") + return + + // construction of frequency description + var/list/available_channels = list() + available_channels += "
  • [span_radio(RADIO_KEY_COMMON)] for the currently tuned frequency
  • " + if(special_channels & RADIO_SPECIAL_BINARY) + available_channels += "
  • [span_binarysay(MODE_TOKEN_BINARY)] for [span_binarysay(capitalize(MODE_BINARY))]
  • " + + for(var/i in 1 to length(channels)) + var/channel_name = channels[i] + var/channel_token = GLOB.channel_tokens[channel_name] + var/channel_span_class = get_radio_span(GLOB.radiochannels[channel_name]) + + if(i == 1) + available_channels += "
  • [span_class(channel_span_class, MODE_TOKEN_DEPARTMENT)] or [span_class(channel_span_class, channel_token)] for [span_class(channel_span_class, channel_name)]
  • " + else + available_channels += "
  • [span_class(channel_span_class, channel_token)] for [span_class(channel_span_class, channel_name)]
  • " + + . += span_notice("A small screen on the headset displays the following available frequencies:") + . += span_notice("") + + if(command) + . += span_info("Alt-click to toggle the high-volume mode.") /obj/item/radio/headset/Initialize(mapload) . = ..() diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 25060d23af5..8391edb8319 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -528,7 +528,7 @@ /obj/item/radio/examine(mob/user) . = ..() if (frequency && in_range(src, user)) - . += span_notice("It is set to broadcast over the [frequency/10] frequency.") + . += span_notice("It is set to broadcast over the [span_radio("[frequency/10]")] frequency.") if (unscrewed) . += span_notice("It can be attached and modified.") else