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’ll 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/radio_whitelist = list(MODE_KEY_BINARY = MODE_KEY_BINARY, MODE_KEY_R_HAND = MODE_KEY_R_HAND, MODE_KEY_L_HAND = MODE_KEY_L_HAND, MODE_KEY_INTERCOM = MODE_KEY_INTERCOM, MODE_KEY_DEPARTMENT , MODE_KEY_DEPARTMENT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean blacklist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I did, sorry

//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] || radio_whitelist[key_prefix])
for(var/letter in splittext(lowertext_name, ""))
if(!GLOB.department_radio_keys[letter])
if(! (GLOB.department_radio_keys[letter] || radio_whitelist[letter]))
key_prefix = letter
break
if(GLOB.department_radio_keys[key_prefix])
if(GLOB.department_radio_keys[key_prefix] || radio_whitelist[key_prefix])
//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] || radio_whitelist[letter]))
key_prefix = letter
break

Expand Down
Loading