Headsets will now show the prefixes necessary to access the channels (#33941)

* prefixes

* Changes CARGO_PREFIX to SUPPLY_PREFIX

* updates comment
This commit is contained in:
boy2mantwicethefam
2023-01-09 21:51:16 +02:00
committed by GitHub
parent 2e0b75e108
commit ed0559ab9c
2 changed files with 49 additions and 2 deletions

View File

@@ -15,6 +15,22 @@
#define RAIDER "Vox Raiders"
#define BUG "Radio Bug"
//Communication prefixes to communicate on these radio freqs. So far only used for detecting which frequency
//belongs to what prefix, showing it off in the radio headset.
//These don't actually determine which prefix belongs to what, it's just a reference point
#define COMMON_PREFIX "o"
#define SECURITY_PREFIX "s"
#define ENGINEERING_PREFIX "e"
#define COMMAND_PREFIX "c"
#define MEDICAL_PREFIX "m"
#define SCIENCE_PREFIX "n"
#define SERVICE_PREFIX "d"
#define SUPPLY_PREFIX "u"
#define DEATHSQUAD_PREFIX "0"
#define RESPONSE_PREFIX "-"
#define AIPRIVATE_PREFIX "p"
#define SYNDICATE_PREFIX "t"
var/list/freq_text = list(COMMON,SECURITY_COMM,ENGINEERING,COMMAND,MEDICAL,SCIENCE,SERVICE,CARGO,DEATHSQUAD_COMM,RESPONSE,AIPRIVATE,DJ,REV_COMM, SYND, RAIDER, BUG)
var/list/freqs = list() //Generated by generate_radio_frequencies, in more_init_stuff.dm
@@ -45,4 +61,4 @@ var/list/radiochannelsreverse = list()
var/list/stationchannels = list()
//For custom stuff
var/list/freqtocolor = list()
var/list/freqtocolor = list()

View File

@@ -119,10 +119,41 @@
/obj/item/device/radio/proc/text_sec_channel(var/chan_name, var/chan_stat)
var/list = !!(chan_stat&FREQ_LISTENING)!=0
var/chan_prefix = fetch_prefix(chan_name)
return {"
<B>[chan_name]</B>: <A href='byond://?src=\ref[src];ch_name=[chan_name];listen=[!list]'>[list ? "Engaged" : "Disengaged"]</A><BR>
<B>[chan_name][chan_prefix ? " (:[chan_prefix]) " : ""]</B>: <A href='byond://?src=\ref[src];ch_name=[chan_name];listen=[!list]'>[list ? "Engaged" : "Disengaged"]</A><BR>
"}
//Finds if there is a defined prefix for the channel noted in _DEFINES/communications.dm
//It's ugly but if it was as easy as slapping [chan_name]_PREFIX to call the associated prefix.
//This way it also doesn't cause unforeseen consequences.
/obj/item/device/radio/proc/fetch_prefix(var/chan_name)
switch(chan_name)
if("Common")
return COMMON_PREFIX
if("Security")
return SECURITY_PREFIX
if("Engineering")
return ENGINEERING_PREFIX
if("Command")
return COMMAND_PREFIX
if("Medical")
return MEDICAL_PREFIX
if("Science")
return SCIENCE_PREFIX
if("Service")
return SERVICE_PREFIX
if("Supply")
return SUPPLY_PREFIX
if("Deathsquad")
return DEATHSQUAD_PREFIX
if("Response Team")
return RESPONSE_PREFIX
if("AI Private")
return AIPRIVATE_PREFIX
if("Syndicate")
return SYNDICATE_PREFIX
/obj/item/device/radio/Topic(href, href_list)
if (!isAdminGhost(usr) && (usr.stat || !on))
return 1