pAI Computer Piloting (#8842)

pAI can now be put into modular computers to control them. When a pAI is inserted, a new service will be unlocked, which can disable their access to the computer.

The VueUI change wasn't tested, but finding and replacing should leave the functionality unchanged.
This commit is contained in:
Geeves
2020-06-05 20:28:52 +02:00
committed by GitHub
parent d880e89342
commit e7194e7893
15 changed files with 131 additions and 18 deletions

View File

@@ -55,6 +55,17 @@
return
found = TRUE
tesla_link = H
else if(istype(H, /obj/item/device/paicard))
if(personal_ai)
to_chat(user, SPAN_WARNING("\The [src]'s personal AI slot is already occupied by \the [personal_ai]."))
return
personal_ai = H
to_chat(user, SPAN_NOTICE("You install \the [H] into \the [src]."))
personal_ai.pai.parent_computer = src
personal_ai.pai.verbs += /mob/living/silicon/pai/proc/personal_computer_interact
to_chat(personal_ai.pai, SPAN_NOTICE("You gain access to \the [src]'s computronics."))
user.drop_from_inventory(H, src)
update_icon()
if(found)
to_chat(user, SPAN_NOTICE("You install \the [H] into \the [src]."))
H.parent_computer = src
@@ -92,6 +103,17 @@
else if(tesla_link == H)
tesla_link = null
found = TRUE
else if(personal_ai == H)
if(user)
to_chat(user, SPAN_NOTICE("You remove \the [H] from \the [src]."))
H.forceMove(get_turf(src))
if(put_in_hands)
user.put_in_hands(H)
personal_ai.pai.verbs -= /mob/living/silicon/pai/proc/personal_computer_interact
to_chat(personal_ai.pai, SPAN_NOTICE("You lose access to \the [src]'s computronics."))
personal_ai.pai.parent_computer = null
update_icon()
personal_ai = null
if(found)
if(user)
@@ -105,7 +127,6 @@
to_chat(user, SPAN_WARNING("\The [src]'s screen freezes for few seconds and then displays, \"HARDWARE ERROR: Critical component disconnected. Please verify component connection and reboot the device. If the problem persists contact technical support for assistance.\"."))
shutdown_computer()
// Checks all hardware pieces to determine if name matches, if yes, returns the hardware piece, otherwise returns null
/obj/item/modular_computer/proc/find_hardware_by_name(var/name)
if(portable_drive && (initial(portable_drive.name) == name))
@@ -124,6 +145,8 @@
return processor_unit
if(ai_slot && (initial(ai_slot.name) == name))
return ai_slot
if(personal_ai && (initial(personal_ai.name) == name))
return personal_ai
if(tesla_link && (initial(tesla_link.name) == name))
return tesla_link
return null
@@ -147,6 +170,8 @@
all_components.Add(processor_unit)
if(ai_slot)
all_components.Add(ai_slot)
if(personal_ai)
all_components.Add(personal_ai)
if(tesla_link)
all_components.Add(tesla_link)
return all_components

View File

@@ -30,6 +30,16 @@
proc_eject_ai(usr)
/obj/item/modular_computer/verb/eject_personal_ai()
set name = "Eject Personal AI"
set category = "Object"
set src in view(1)
if(use_check_and_message(usr))
return
proc_eject_personal_ai(usr)
/obj/item/modular_computer/proc/proc_eject_id(mob/user)
if(!user)
user = usr
@@ -87,6 +97,17 @@
ai_slot.update_power_usage()
update_uis()
/obj/item/modular_computer/proc/proc_eject_personal_ai(mob/user)
if(!personal_ai)
to_chat(user, SPAN_WARNING("There is no personal AI connected to \the [src]."))
return
personal_ai.pai.verbs -= /mob/living/silicon/pai/proc/personal_computer_interact
personal_ai.pai.parent_computer = null
to_chat(personal_ai.pai, SPAN_NOTICE("You lose access to \the [src]'s computronics."))
uninstall_component(user, personal_ai, put_in_hands = TRUE)
update_uis()
/obj/item/modular_computer/attack_ghost(var/mob/abstract/observer/user)
if(enabled)
ui_interact(user)
@@ -154,6 +175,8 @@
try_install_component(user, C)
else
to_chat(user, SPAN_WARNING("This component is too large for \the [src]."))
if(istype(W, /obj/item/device/paicard))
try_install_component(user, W)
if(W.iswrench())
var/list/components = get_all_components()
if(components.len)

View File

@@ -47,6 +47,8 @@
var/datum/computer_file/data/autorun = hard_drive.find_file_by_name("autorun")
VUEUI_SET_CHECK_IFNOTSET(data["programs"], list(), ., data)
for(var/datum/computer_file/program/P in hard_drive.stored_files)
if(P.program_hidden())
continue
VUEUI_SET_CHECK_IFNOTSET(data["programs"][P.filename], list(), ., data)
VUEUI_SET_CHECK(data["programs"][P.filename]["desc"], P.filedesc, ., data)
VUEUI_SET_CHECK(data["programs"][P.filename]["autorun"], (istype(autorun) && (autorun.stored_data == P.filename)), ., data)

View File

@@ -17,9 +17,10 @@
var/apc_powered = FALSE // Set automatically. Whether the computer used APC power last tick.
var/base_active_power_usage = 50 // Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too.
var/base_idle_power_usage = 5 // Power usage when the computer is idle and screen is off (currently only applies to laptops)
var/enrolled = 0 // Weather the computer is enrolled in the company device management or not. 0 - unconfigured 1 - enrolled (work device) 2 - unenrolled (private device)
var/enrolled = 0 // Weather the computer is enrolled in the company device management or not. 0 - unconfigured 1 - enrolled (work device) 2 - unenrolled (private device)
var/_app_preset_type // Used for specifying the software preset of the console
var/ambience_last_played // Last time sound was played
var/pAI_lock = FALSE // Toggles whether pAI can interact with the modular computer while installed in it
// Modular computers can run on various devices. Each DEVICE (Laptop, Console, Tablet,..)
// must have it's own DMI file. Icon states must be called exactly the same in all files, but may look differently
@@ -62,6 +63,7 @@
var/obj/item/computer_hardware/hard_drive/portable/portable_drive // Portable data storage
var/obj/item/computer_hardware/ai_slot/ai_slot // AI slot, an intellicard housing that allows modifications of AIs.
var/obj/item/computer_hardware/tesla_link/tesla_link // Tesla Link, Allows remote charging from nearest APC.
var/obj/item/device/paicard/personal_ai // Personal AI, can control the device via a verb when installed
var/listener/listener //Listener needed for things