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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds radio blacklist for non radio tokens in use #16224

Merged
merged 9 commits into from
Jul 5, 2024
9 changes: 5 additions & 4 deletions code/datums/jobs/squads.dm
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@
GLOBAL_LIST_EMPTY_TYPED(custom_squad_radio_freqs, /datum/squad)
///initializes a new custom squad. all args mandatory
/proc/create_squad(squad_name, squad_color, mob/living/carbon/human/creator)
var/list/radio_blacklist = list(MODE_KEY_BINARY, MODE_KEY_R_HAND, MODE_KEY_L_HAND, MODE_KEY_INTERCOM, MODE_KEY_DEPARTMENT)
//Create the squad
if(!squad_name)
return
Expand All @@ -443,15 +444,15 @@ GLOBAL_LIST_EMPTY_TYPED(custom_squad_radio_freqs, /datum/squad)
LAZYADDASSOCSIMPLE(GLOB.reverseradiochannels, "[freq]", radio_channel_name)
new_squad.faction = squad_faction
var/key_prefix = lowertext_name[1]
if(GLOB.department_radio_keys[key_prefix])
if(GLOB.department_radio_keys[key_prefix] || (key_prefix in radio_blacklist))
for(var/letter in splittext(lowertext_name, ""))
if(!GLOB.department_radio_keys[letter])
if(!(GLOB.department_radio_keys[letter] && !(letter in radio_blacklist)))
key_prefix = letter
break
if(GLOB.department_radio_keys[key_prefix])
if(GLOB.department_radio_keys[key_prefix] || (key_prefix in radio_blacklist))
//okay... mustve been a very short name, randomly pick things from the alphabet now
for(var/letter in shuffle(GLOB.alphabet))
if(!GLOB.department_radio_keys[letter])
if(!(GLOB.department_radio_keys[letter] && !(letter in radio_blacklist)))
key_prefix = letter
break

Expand Down
Loading