pAIs control a PDA they're inserted into (#78103)

## About The Pull Request

This PR lets pAIs inserted into a PDA to control the PDA of their owner.
They can see their own pAI configurations but cannot edit any of it.
They also can't eject themselves from it.
This means they can receive and send PDA messages as their owner, acting
like a personal secretary

This also adds support for multiple people using a PDA and its UI
updating for all of them and PDA messages being received and responded
to from multiple people under the same PDA
It also removes pAI camera in favor of using siliconcamera, which is the
same thing; this just cuts down on some copy paste.

I also reverted PDA's ringer being off preventing messages from being
sent to your chat, silent mode was meant to prevent only the ringing
sound.

## Why It's Good For The Game

pAIs can now do a little bit more to help their owners on a personal
level, and adds support for more stuff like this in the future (an idea
I had was being able to hack into PDAs in the same way the CE can hack
into APCs remotely)

This is a re-PR of https://github.com/tgstation/tgstation/pull/76445 but
it's a little better this time and does not remove the PDA Messenger app
from pAIs.

## Changelog

🆑
fix: PDAs being on silent no longer prevents PDAs from being sent to
your chat, again.
add: pAIs inserted into a PDA can now control the PDA, and will receive
PDA messages sent to it (and can respond under the PDA's name).
/🆑
This commit is contained in:
John Willard
2023-09-04 16:32:52 +00:00
committed by GitHub
parent 2839a8ede5
commit fe104cf8da
13 changed files with 97 additions and 65 deletions
@@ -200,10 +200,7 @@
return TRUE
if(istype(inserted_pai)) // Remove pAI
user.put_in_hands(inserted_pai)
balloon_alert(user, "removed pAI")
inserted_pai = null
update_appearance(UPDATE_ICON)
remove_pai(user)
return TRUE
// Gets IDs/access levels from card slot. Would be useful when/if PDAs would become modular PCs. //guess what
@@ -414,7 +411,7 @@
var/mob/living/carbon/human/human_wearer = loc
human_wearer.sec_hud_set_ID()
if(inserted_pai == gone)
inserted_pai = null
update_appearance(UPDATE_ICON)
if(inserted_disk == gone)
inserted_disk = null
update_appearance(UPDATE_ICON)
@@ -713,12 +710,7 @@
return
// Inserting a pAI
if(istype(attacking_item, /obj/item/pai_card) && !inserted_pai)
if(!user.transferItemToLoc(attacking_item, src))
return
inserted_pai = attacking_item
balloon_alert(user, "inserted pai")
update_appearance(UPDATE_ICON)
if(istype(attacking_item, /obj/item/pai_card) && insert_pai(user, attacking_item))
return
if(istype(attacking_item, /obj/item/stock_parts/cell))
@@ -792,7 +784,7 @@
internal_cell?.forceMove(drop_location())
computer_id_slot?.forceMove(drop_location())
inserted_disk?.forceMove(drop_location())
inserted_pai?.forceMove(drop_location())
remove_pai()
new /obj/item/stack/sheet/iron(get_turf(loc), steel_sheet_cost)
user.balloon_alert(user, "disassembled")
relay_qdel()
@@ -840,3 +832,30 @@
///Returns a string of what to send at the end of messenger's messages.
/obj/item/modular_computer/proc/get_messenger_ending()
return "Sent from my PDA"
/obj/item/modular_computer/proc/insert_pai(mob/user, obj/item/pai_card/card)
if(inserted_pai)
return FALSE
if(!user.transferItemToLoc(card, src))
return FALSE
inserted_pai = card
balloon_alert(user, "inserted pai")
var/datum/action/innate/pai/messenger/messenger_ability = new(inserted_pai.pai)
messenger_ability.Grant(inserted_pai.pai)
update_appearance(UPDATE_ICON)
return TRUE
/obj/item/modular_computer/proc/remove_pai(mob/user)
if(!inserted_pai)
return FALSE
var/datum/action/innate/pai/messenger/messenger_ability = locate() in inserted_pai.pai.actions
messenger_ability.Remove(inserted_pai.pai)
qdel(messenger_ability)
if(user)
user.put_in_hands(inserted_pai)
balloon_alert(user, "removed pAI")
else
inserted_pai.forceMove(drop_location())
inserted_pai = null
update_appearance(UPDATE_ICON)
return TRUE
@@ -20,15 +20,21 @@
active_ui = new(user, src, "NtosMain")
return active_ui.open()
if(active_program)
active_ui.interface = active_program.tgui_id
active_ui.title = active_program.filedesc
active_program.ui_interact(user, active_ui)
else
active_ui.interface = "NtosMain"
for (var/datum/tgui/window as anything in open_uis)
if(active_program)
window.interface = active_program.tgui_id
window.title = active_program.filedesc
active_program.ui_interact(user, window)
else
window.interface = "NtosMain"
window.send_assets()
update_static_data_for_all_viewers()
update_static_data(user, active_ui)
active_ui.send_assets()
/obj/item/modular_computer/ui_state(mob/user)
if(inserted_pai && (user == inserted_pai.pai))
return GLOB.contained_state
return ..()
/obj/item/modular_computer/interact(mob/user)
if(enabled)
@@ -206,10 +212,9 @@
if("PC_Pai_Interact")
switch(params["option"])
if("eject")
usr.put_in_hands(inserted_pai)
to_chat(usr, span_notice("You remove [inserted_pai] from the [name]."))
inserted_pai = null
update_appearance(UPDATE_ICON)
if(!ishuman(usr))
return
remove_pai(usr)
if("interact")
inserted_pai.attack_self(usr)
return TRUE
@@ -83,7 +83,7 @@
/obj/item/modular_computer/pda/interact(mob/user)
. = ..()
if(HAS_TRAIT(src, TRAIT_PDA_MESSAGE_MENU_RIGGED))
explode(usr, from_message_menu = TRUE)
explode(user, from_message_menu = TRUE)
/obj/item/modular_computer/pda/attack_self(mob/user)
// bypass literacy checks to access syndicate uplink