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

Commit 3aaa447

Browse files
authored
pAI record modules, general bugfixes, and misc additions (#22896)
* Who thought it was a good idea to name those fields that? * I guess it doesn't want to work * Improvements + access copying * Well, that was a simple fix * Access card + meson + nightvision * Moves var comments * More cleaning up * Table * Med records * Sec records * Reorganises remote signaller * Autodoc comment support * Minor adjustments * Another adjustment
1 parent 34da076 commit 3aaa447

File tree

6 files changed

+626
-197
lines changed

6 files changed

+626
-197
lines changed

code/controllers/subsystem/pai.dm

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,6 @@ SUBSYSTEM_DEF(pai)
99
var/list/paicard_list = list()
1010

1111
/datum/controller/subsystem/pai/Topic(href, href_list[])
12-
if(href_list["download"])
13-
var/datum/paiCandidate/candidate = locate(href_list["candidate"]) in candidates
14-
var/obj/item/computer_hardware/paicard/card = locate(href_list["device"]) in paicard_list
15-
if(card.pai)
16-
return
17-
if(istype(card, /obj/item/computer_hardware/paicard) && istype(candidate, /datum/paiCandidate))
18-
if(check_ready(candidate) != candidate)
19-
return FALSE
20-
var/mob/living/silicon/pai/pai = new(card)
21-
if(!candidate.name)
22-
pai.name = pick(GLOB.ninja_names)
23-
else
24-
pai.name = candidate.name
25-
pai.real_name = pai.name
26-
pai.key = candidate.key
27-
28-
card.setPersonality(pai)
29-
30-
candidates -= candidate
31-
usr << browse(null, "window=findPai")
32-
3312
if(href_list["new"])
3413
var/datum/paiCandidate/candidate = locate(href_list["candidate"]) in candidates
3514
var/option = href_list["option"]

code/game/machinery/doors/door.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@
244244
return TRUE
245245
if(unrestricted_side(M))
246246
return TRUE
247+
if(ispAI(M))
248+
var/mob/living/silicon/pai/P = M
249+
return check_access(P.access_card)
247250
return ..()
248251

249252
/// Returns the opposite of '/allowed', but makes exceptions for things like IsAdminGhost().

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

Lines changed: 62 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
hud_type = /datum/hud/pai
88
pass_flags = PASSTABLE | PASSMOB
99
mob_size = MOB_SIZE_TINY
10-
desc = "A generic pAI mobile hard-light holographics emitter. It seems to be deactivated."
10+
desc = "A generic pAI mobile hard-light holographics emitter. It seems to be activated."
1111
weather_immunities = WEATHER_STORM
1212
light_on = FALSE
1313
light_flags = LIGHT_ATTACHED
@@ -23,53 +23,55 @@
2323
var/network = "ss13"
2424
var/obj/machinery/camera/current = null
2525

26-
var/ram = 100 // Used as currency to purchase different abilities
26+
///Used as currency to purchase different abilities
27+
var/ram = 100
2728
var/list/software = list()
28-
var/userDNA // The DNA string of our assigned user
29-
var/obj/item/computer_hardware/paicard/card // The card we inhabit
30-
var/hacking = FALSE //Are we hacking a door?
29+
///The DNA string of our assigned user
30+
var/userDNA
31+
///The card we inhabit
32+
var/obj/item/computer_hardware/paicard/card
33+
///Are we hacking a door?
34+
var/hacking = FALSE
3135

3236
var/speakStatement = "states"
3337
var/speakExclamation = "declares"
3438
var/speakDoubleExclamation = "alarms"
3539
var/speakQuery = "queries"
3640

37-
var/obj/item/pai_cable/cable // The cable we produce and use when door or camera jacking
41+
///The cable we produce and use when door or camera jacking
42+
var/obj/item/pai_cable/cable
3843

39-
var/master // Name of the one who commands us
40-
var/master_dna // DNA string for owner verification
44+
///Name of the one who commands us
45+
var/master
46+
///DNA string for owner verification
47+
var/master_dna
4148

4249
// Various software-specific vars
4350

44-
var/temp // General error reporting text contained here will typically be shown once and cleared
45-
var/screen // Which screen our main window displays
46-
var/subscreen // Which specific function of the main screen is being displayed
51+
///The airlock being hacked
52+
var/obj/machinery/door/hackdoor
53+
///Possible values: 0 - 100, >= 100 means the hack is complete and will be reset upon next check
54+
var/hackprogress = 0
4755

48-
var/secHUD = 0 // Toggles whether the Security HUD is active or not
49-
var/medHUD = 0 // Toggles whether the Medical HUD is active or not
50-
51-
var/datum/data/record/medicalActive1 // Datacore record declarations for record software
52-
var/datum/data/record/medicalActive2
53-
54-
var/datum/data/record/securityActive1 // Could probably just combine all these into one
55-
var/datum/data/record/securityActive2
56-
57-
var/obj/machinery/door/hackdoor // The airlock being hacked
58-
var/hackprogress = 0 // Possible values: 0 - 100, >= 100 means the hack is complete and will be reset upon next check
59-
60-
/// Remote signaler
56+
///Remote signaler
6157
var/obj/item/assembly/signaler/internal/signaler
6258

6359
var/obj/item/instrument/piano_synth/internal_instrument
64-
var/obj/machinery/newscaster //pAI Newscaster
65-
var/obj/item/healthanalyzer/hostscan //pAI healthanalyzer
60+
///pAI Newscaster
61+
var/obj/machinery/newscaster
62+
///pAI healthanalyzer
63+
var/obj/item/healthanalyzer/hostscan
6664

65+
///Whether the pAI has bought the encryption slot module or not
6766
var/encryptmod = FALSE
6867
var/holoform = FALSE
68+
///Can pAI use their holoprojector?
6969
var/canholo = TRUE
70+
///Can pAI transmit radio messages?
7071
var/can_transmit = TRUE
72+
///Can pAI receive radio messages?
7173
var/can_receive = TRUE
72-
var/obj/item/card/id/access_card = null
74+
var/obj/item/card/id/access_card = new /obj/item/card/id
7375
var/chassis = "repairbot"
7476
var/list/possible_chassis = list("cat" = TRUE, "mouse" = TRUE, "monkey" = TRUE, "corgi" = FALSE, "fox" = FALSE, "repairbot" = TRUE, "rabbit" = TRUE, "frog" = TRUE) //assoc value is whether it can be picked up.
7577

@@ -81,7 +83,8 @@
8183
var/emittersemicd = FALSE
8284

8385
var/overload_ventcrawl = 0
84-
var/overload_bulletblock = 0 //Why is this a good idea?
86+
//Why is this a good idea?
87+
var/overload_bulletblock = 0
8588
var/overload_maxhealth = 0
8689
var/silent = FALSE
8790
var/brightness_power = 5
@@ -127,7 +130,6 @@
127130

128131
. = ..()
129132

130-
create_modularInterface()
131133
emittersemicd = TRUE
132134
addtimer(CALLBACK(src, PROC_REF(emittercool)), 600)
133135

@@ -153,7 +155,6 @@
153155
if(cable && cable.machine && istype(cable.machine, /obj/machinery/door) && cable.machine == hackdoor && get_dist(src, hackdoor) <= 1)
154156
hackprogress = clamp(hackprogress + 20, 0, 100)
155157
else
156-
temp = "Door Jack: Connection to airlock has been lost. Hack aborted."
157158
hackprogress = 0
158159
hacking = FALSE
159160
hackdoor = null
@@ -282,7 +283,11 @@
282283

283284
/mob/living/silicon/pai/examine(mob/user)
284285
. = ..()
285-
. += "A personal AI in holochassis mode. Its master ID string seems to be [master]."
286+
. += "A personal AI in holochassis mode. Its master ID string seems to be [master ? master : "empty"]."
287+
if(software && isobserver(user))
288+
. += "<b>[src] has the following modules:</b>"
289+
for(var/module in software)
290+
. += "[module]"
286291

287292
/mob/living/silicon/pai/Life(seconds_per_tick = SSMOBS_DT, times_fired)
288293
if(stat == DEAD)
@@ -307,12 +312,31 @@
307312
emitterhealth = clamp((emitterhealth + (emitter_regen_per_second * delta_time)), -50, emittermaxhealth)
308313

309314
/obj/item/computer_hardware/paicard/attackby(obj/item/W, mob/user, params)
310-
..()
315+
. = ..()
311316
user.set_machine(src)
312-
if(pai.encryptmod == TRUE)
313-
if(W.tool_behaviour == TOOL_SCREWDRIVER)
314-
pai.radio.attackby(W, user, params)
315-
else if(istype(W, /obj/item/encryptionkey))
317+
if(W.tool_behaviour == TOOL_SCREWDRIVER||istype(W, /obj/item/encryptionkey))
318+
if(pai.encryptmod == TRUE)
316319
pai.radio.attackby(W, user, params)
317-
else
318-
to_chat(user, "Encryption Key ports not configured.")
320+
else
321+
to_chat(user, "Encryption Key ports not configured.")
322+
else if(istype(W, /obj/item/card/id))
323+
var/obj/item/card/id/id_card = W
324+
pai.copy_access(id_card, user)
325+
326+
/mob/living/silicon/pai/attackby(obj/item/W, mob/user, params)
327+
. = ..()
328+
if(istype(W, /obj/item/card/id))
329+
var/obj/item/card/id/id_card = W
330+
copy_access(id_card, user)
331+
332+
/mob/living/silicon/pai/proc/copy_access(obj/item/card/id/ID, mob/user)
333+
access_card.access += ID.access
334+
to_chat(user, span_info("Copied access from [ID]!"))
335+
to_chat(src, span_notice("Data transfer complete: New access encryption keys stored in memory."))
336+
337+
/mob/living/silicon/pai/Bump(atom/A) //Copied from bot.dm
338+
. = ..()
339+
if((istype(A, /obj/machinery/door/airlock) || istype(A, /obj/machinery/door/window)) && (!isnull(access_card)))
340+
var/obj/machinery/door/D = A
341+
if(D.check_access(access_card))
342+
D.open()

0 commit comments

Comments
 (0)