Special radio channels now use bitflags instead of individual vars (#85150)

## About The Pull Request

Radios/encryption keys now use a `RADIO_SPECIAL_XXXXX` bitflag for
behaviors related to "special" radio channels (Binary, Centcom, Syndie).

I decided to do this because I wanted to add a radio channel for pirates
and hunters (hence the branch name), but it felt weird adding two more
variables. The more I look at the changes I've made here the more I
realize that the effort was probably not worth the utility but whatever.

This also subtypes some varedited intercoms and makes them their own
objects.
## Why It's Good For The Game

Compresses a whopping three (3!) variables into a single one. Easier to
scale (I guess?). I felt like adding a fourth/fifth variable and just
moving on with the original project, but decided "lets do this the
unnecessarily hard way instead".
## Changelog
🆑 Rhials
code: Radios/encryption keys now use a single variable for "special"
frequencies. Please report if you experience any strangeness with
accessing/being unable to access the Centcom, Syndicate, or Cyborg
radio.
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
Rhials
2024-08-18 17:23:46 -04:00
committed by GitHub
parent 86329bf4c3
commit 00a0d0b890
15 changed files with 66 additions and 83 deletions
+6 -6
View File
@@ -153,15 +153,15 @@ ADMIN_VERB(borg_panel, R_ADMIN, "Show Borg Panel", ADMIN_VERB_NO_DESCRIPTION, AD
if (!borg.radio.keyslot) // There's no encryption key. This shouldn't happen but we can cope
borg.radio.channels -= channel
if (channel == RADIO_CHANNEL_SYNDICATE)
borg.radio.syndie = FALSE
borg.radio.special_channels &= ~RADIO_SPECIAL_SYNDIE
else if (channel == "CentCom")
borg.radio.independent = FALSE
borg.radio.special_channels &= ~RADIO_SPECIAL_CENTCOM
else
borg.radio.keyslot.channels -= channel
if (channel == RADIO_CHANNEL_SYNDICATE)
borg.radio.keyslot.syndie = FALSE
borg.radio.keyslot.special_channels &= ~RADIO_SPECIAL_SYNDIE
else if (channel == "CentCom")
borg.radio.keyslot.independent = FALSE
borg.radio.keyslot.special_channels &= ~RADIO_SPECIAL_CENTCOM
message_admins("[key_name_admin(user)] removed the [channel] radio channel from [ADMIN_LOOKUPFLW(borg)].")
log_silicon("[key_name(user)] removed the [channel] radio channel from [key_name(borg)].")
else // We're adding a channel
@@ -169,9 +169,9 @@ ADMIN_VERB(borg_panel, R_ADMIN, "Show Borg Panel", ADMIN_VERB_NO_DESCRIPTION, AD
borg.radio.keyslot = new()
borg.radio.keyslot.channels[channel] = 1
if (channel == RADIO_CHANNEL_SYNDICATE)
borg.radio.keyslot.syndie = TRUE
borg.radio.keyslot.special_channels |= RADIO_SPECIAL_SYNDIE
else if (channel == "CentCom")
borg.radio.keyslot.independent = TRUE
borg.radio.keyslot.special_channels |= RADIO_SPECIAL_CENTCOM
message_admins("[key_name_admin(user)] added the [channel] radio channel to [ADMIN_LOOKUPFLW(borg)].")
log_silicon("[key_name(user)] added the [channel] radio channel to [key_name(borg)].")
borg.radio.recalculateChannels()