Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit faf8fdc

Browse files
committed
Improvements + access copying
1 parent 08cdafb commit faf8fdc

File tree

3 files changed

+31
-17
lines changed

3 files changed

+31
-17
lines changed

code/modules/mob/living/silicon/pai/pai.dm

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272

273273
/mob/living/silicon/pai/examine(mob/user)
274274
. = ..()
275-
. += "A personal AI in holochassis mode. Its master ID string seems to be [master]."
275+
. += "A personal AI in holochassis mode. Its master ID string seems to be [master ? master : "empty"]."
276276
if(software && isobserver(user))
277277
. += "<b>[src] has the following modules:"
278278
for(var/list/module in software)
@@ -287,7 +287,7 @@
287287
T.visible_message(span_warning("[src.cable] rapidly retracts back into its spool."), span_italics("You hear a click and the sound of wire spooling rapidly."))
288288
qdel(src.cable)
289289
cable = null
290-
cable_status = "Retracted"
290+
cable_status = PAI_CABLE_RETRACTED
291291
silent = max(silent - 1, 0)
292292
. = ..()
293293

@@ -303,10 +303,21 @@
303303
/obj/item/computer_hardware/paicard/attackby(obj/item/W, mob/user, params)
304304
. = ..()
305305
user.set_machine(src)
306-
if(pai.encryptmod == TRUE)
307-
if(W.tool_behaviour == TOOL_SCREWDRIVER)
306+
if(W.tool_behaviour == TOOL_SCREWDRIVER||istype(W, /obj/item/encryptionkey))
307+
if(pai.encryptmod == TRUE)
308308
pai.radio.attackby(W, user, params)
309-
else if(istype(W, /obj/item/encryptionkey))
310-
pai.radio.attackby(W, user, params)
311-
else
312-
to_chat(user, "Encryption Key ports not configured.")
309+
else
310+
to_chat(user, "Encryption Key ports not configured.")
311+
else if(istype(W, /obj/item/card/id))
312+
var/obj/item/card/id/id_card = W
313+
pai.copy_access(id_card, user)
314+
315+
/mob/living/silicon/pai/attackby(obj/item/W, mob/user, params)
316+
. = ..()
317+
if(istype(W, /obj/item/card/id))
318+
var/obj/item/card/id/id_card = W
319+
copy_access(id_card, user)
320+
321+
/mob/living/silicon/pai/proc/copy_access(obj/item/card/id/ID, mob/user)
322+
pai.access_card.access += ID.access
323+
to_chat(user, "Copied access from [ID]!")

code/modules/mob/living/silicon/pai/software.dm

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// - Potentially roll HUDs and Records into one
33
// - Shock collar/lock system for prisoner pAIs?
44
// - Camera jack
5-
5+
#define PAI_CABLE_RETRACTED 0
6+
#define PAI_CABLE_EXTENDED 1
67

78
/mob/living/silicon/pai/var/list/available_software = list(
89
//Nightvision
@@ -39,7 +40,7 @@
3940
/mob/living/silicon/pai/var/pressure
4041
/mob/living/silicon/pai/var/gases
4142

42-
/mob/living/silicon/pai/var/cable_status = "Retracted"
43+
/mob/living/silicon/pai/var/cable_status = PAI_CABLE_RETRACTED
4344

4445
/mob/living/silicon/pai/var/list/med_record = list()
4546
/mob/living/silicon/pai/var/list/sec_record = list()
@@ -94,7 +95,7 @@
9495
qdel(new_record)
9596
break
9697
message_admins("Len: [med_record.len]")
97-
message_admins("Record test: [med_record[0]")
98+
message_admins("Record test: [med_record[0]]")
9899
if(GLOB.data_core.general && GLOB.data_core.security)
99100
sec_record = list()
100101
for(var/datum/data/record/S in sortRecord(GLOB.data_core.security))
@@ -212,13 +213,15 @@
212213
internal_instrument = new(src)
213214
internal_instrument.interact(src)
214215
if("cable")
216+
if(cable_status == PAI_CABLE_EXTENDED)
217+
return
215218
var/turf/T = get_turf(loc)
216219
cable = new /obj/item/pai_cable(T)
217220
if(get(card, /mob/living/carbon/human))
218221
var/mob/living/carbon/human/H = get(card, /mob/living/carbon/human)
219222
H.put_in_hands(cable)
220223
T.visible_message(span_warning("A port on [src] opens to reveal [cable], which promptly falls to the floor."), span_italics("You hear the soft click of something light and hard falling to the ground."))
221-
cable_status = "Extended"
224+
cable_status = PAI_CABLE_EXTENDED
222225
if("jack")
223226
if(cable && cable.machine)
224227
hackdoor = cable.machine
@@ -231,7 +234,7 @@
231234
qdel(cable)
232235
hackdoor = null
233236
cable = null
234-
cable_status = "Retracted"
237+
cable_status = PAI_CABLE_RETRACTED
235238
update_appearance(UPDATE_ICON)
236239

237240
/mob/living/silicon/pai/ui_state(mob/user)

tgui/packages/tgui/interfaces/PaiInterface.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type Data = {
6161
temperature: number;
6262
hacking: boolean;
6363
hackprogress: number;
64-
cable: string;
64+
cable: boolean;
6565
door: string[];
6666
code: number;
6767
frequency: number;
@@ -381,17 +381,17 @@ const PaiBox = (props, context) => {
381381
maxValue={100}>
382382
{AirlockJackTextSwitch(hackprogress)}
383383
</ProgressBar>
384-
{cable === "Retracted" && (
384+
{cable === false && (
385385
<Button onClick={() => act("cable")}>
386386
Extend cable
387387
</Button>
388388
)}
389-
{cable === "Extended" && (
389+
{cable === true && (
390390
<Button onClick={() => act("retract")}>
391391
Retract cable
392392
</Button>
393393
)}
394-
{cable === "Extended" && door !== null && (
394+
{cable === true && door !== null && (
395395
hacking ? (
396396
<Button onClick={() => act("cancel")}>
397397
Cancel Airlock Jack

0 commit comments

Comments
 (0)