mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-18 11:30:35 +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
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
/datum/computer_file/program/pai_radio/ui_interact(mob/user)
|
||||
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
|
||||
if (!ui)
|
||||
ui = new /datum/vueui/modularcomputer(user, src, "mcomputer-pai-radio", 400, 150, "pAI Radio Configuration")
|
||||
ui = new /datum/vueui/modularcomputer(user, src, "mcomputer-pai-radio", 450, 400, "pAI Radio Configuration")
|
||||
ui.open()
|
||||
|
||||
/datum/computer_file/program/pai_radio/vueui_transfer(oldobj)
|
||||
SSvueui.transfer_uis(oldobj, src, "mcomputer-pai-radio", 400, 150, "pAI Radio Configuration")
|
||||
SSvueui.transfer_uis(oldobj, src, "mcomputer-pai-radio", 450, 400, "pAI Radio Configuration")
|
||||
return TRUE
|
||||
|
||||
// Gaters data for ui
|
||||
@@ -25,7 +25,6 @@
|
||||
var/headerdata = get_header_data(data["_PC"])
|
||||
if(headerdata)
|
||||
data["_PC"] = headerdata
|
||||
. = data
|
||||
|
||||
if(!istype(computer, /obj/item/modular_computer/silicon))
|
||||
return
|
||||
@@ -34,14 +33,20 @@
|
||||
return
|
||||
var/mob/living/silicon/pai/host = true_computer.computer_host
|
||||
|
||||
VUEUI_SET_CHECK(data["listening"], host.radio.broadcasting, ., data)
|
||||
VUEUI_SET_CHECK(data["frequency"], format_frequency(host.radio.frequency), ., data)
|
||||
data["listening"] = host.radio.broadcasting
|
||||
data["frequency"] = format_frequency(host.radio.frequency)
|
||||
|
||||
LAZYINITLIST(data["channels"])
|
||||
var/list/pai_channels = list()
|
||||
for(var/ch_name in host.radio.channels)
|
||||
var/ch_stat = host.radio.channels[ch_name]
|
||||
VUEUI_SET_CHECK(data["channels"][ch_name], !!(ch_stat & host.radio.FREQ_LISTENING), ., data)
|
||||
|
||||
var/list/channel_info = list(
|
||||
"name" = ch_name,
|
||||
"listening" = (host.radio.channels[ch_name] & host.radio.FREQ_LISTENING)
|
||||
)
|
||||
pai_channels[++pai_channels.len] = channel_info
|
||||
data["channels"] = pai_channels
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/pai_radio/Topic(href, href_list)
|
||||
. = ..()
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
author: Geeves
|
||||
|
||||
delete-after: True
|
||||
|
||||
changes:
|
||||
- rscadd: "Clicking on a folded up pAI with an encryption key now slots the key into the pAI card, granting it access to those radio channels."
|
||||
- rscadd: "You can remove pAI encryption keys by using a screwdriver on them."
|
||||
@@ -12,14 +12,15 @@
|
||||
<vui-button :params="{freq:2, nowindow:1}">+</vui-button>
|
||||
<vui-button :params="{freq:10, nowindow:1}">++</vui-button>
|
||||
</vui-group-item>
|
||||
<vui-group-item v-for="(channel_listening, name) in channels" :label="name" :key="name">
|
||||
<hr>
|
||||
<vui-group-item v-for="channel in channels" :label="channel.name" :key="channel.name">
|
||||
<vui-button
|
||||
:class="{selected: channel_listening}"
|
||||
:params="{channel:value.name, listen: 1, nowindow: 1}"
|
||||
:class="{selected: channel.listening}"
|
||||
:params="{ch_name: channel.name, listen: 1, nowindow: 1}"
|
||||
>On</vui-button>
|
||||
<vui-button
|
||||
:class="{selected: !channel_listening}"
|
||||
:params="{channel:value.name, listen: 1, nowindow: 1}"
|
||||
:class="{selected: !channel.listening}"
|
||||
:params="{ch_name: channel.name, listen: 1, nowindow: 1}"
|
||||
>Off</vui-button>
|
||||
</vui-group-item>
|
||||
</vui-group>
|
||||
|
||||
Reference in New Issue
Block a user