mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-20 12:29:23 +01:00
pAI Encryption Keys (#10537)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
w_class = ITEMSIZE_SMALL
|
||||
slot_flags = SLOT_BELT
|
||||
origin_tech = list(TECH_DATA = 2)
|
||||
var/list/installed_encryptionkeys = list()
|
||||
var/obj/item/device/radio/radio
|
||||
var/looking_for_personality = 0
|
||||
var/mob/living/silicon/pai/pai
|
||||
@@ -47,7 +48,51 @@
|
||||
/obj/item/device/paicard/attackby(obj/item/C as obj, mob/user as mob)
|
||||
if(istype(C, /obj/item/card/id))
|
||||
scan_ID(C, user)
|
||||
else if(istype(C, /obj/item/device/encryptionkey))
|
||||
if(length(installed_encryptionkeys) > 2)
|
||||
to_chat(user, SPAN_WARNING("\The [src] already has the full number of possible encryption keys installed!"))
|
||||
return
|
||||
var/obj/item/device/encryptionkey/EK = C
|
||||
var/added_channels = FALSE
|
||||
for(var/thing in (EK.channels | EK.additional_channels))
|
||||
if(!radio.channels[thing])
|
||||
added_channels = TRUE
|
||||
break
|
||||
if(added_channels)
|
||||
installed_encryptionkeys += EK
|
||||
user.drop_from_inventory(EK, src)
|
||||
user.visible_message("<b>[user]</b> slides \the [EK] into \the [src]'s encryption key slot.", SPAN_NOTICE("You slide \the [EK] into \the [src]'s encryption key slot, granting it access to the radio channels."))
|
||||
recalculateChannels()
|
||||
if(pai)
|
||||
to_chat(pai, SPAN_NOTICE("You now have access to these radio channels: [english_list(radio.channels)]."))
|
||||
else
|
||||
to_chat(user, SPAN_WARNING("\The [src] would not gain any new channels from \the [EK]."))
|
||||
else if(C.isscrewdriver())
|
||||
if(!length(installed_encryptionkeys))
|
||||
to_chat(user, SPAN_WARNING("There are no installed encryption keys to remove!"))
|
||||
return
|
||||
user.visible_message("<b>[user]</b> uses \the [C] to pop the encryption key[length(installed_encryptionkeys) > 1 ? "s" : ""] out of \the [src].", SPAN_NOTICE("You use \the [C] to pop the encryption key[length(installed_encryptionkeys) > 1 ? "s" : ""] out of \the [src]."))
|
||||
for(var/key in installed_encryptionkeys)
|
||||
var/obj/item/device/encryptionkey/EK = key
|
||||
EK.forceMove(get_turf(src))
|
||||
installed_encryptionkeys -= EK
|
||||
recalculateChannels()
|
||||
|
||||
/obj/item/device/paicard/proc/recalculateChannels()
|
||||
radio.channels = list()
|
||||
|
||||
for(var/keyslot in installed_encryptionkeys)
|
||||
var/obj/item/device/encryptionkey/EK = keyslot
|
||||
for(var/ch_name in (EK.channels | EK.additional_channels))
|
||||
radio.channels[ch_name] = radio.FREQ_LISTENING
|
||||
|
||||
for(var/ch_name in radio.channels)
|
||||
if(!SSradio)
|
||||
sleep(30) // Waiting for the SSradio to be created.
|
||||
if(!SSradio)
|
||||
radio.name = "broken radio headset"
|
||||
return
|
||||
radio.secure_radio_connections[ch_name] = SSradio.add_object(radio, radiochannels[ch_name], RADIO_CHAT)
|
||||
|
||||
//This proc is called when the user scans their ID on the pAI card.
|
||||
//It registers their ID and copies their access to the pai, allowing it to use airlocks the owner can
|
||||
|
||||
Reference in New Issue
Block a user