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
@@ -651,17 +651,17 @@
if(!isnull(viewing_messages_of) && viewing_messages_of == sender_ref)
viewing_messages_of = REF(chat)
var/mob/living/receiver_mob = null
//Check our immediate loc
if(isliving(computer.loc))
receiver_mob = computer.loc
//Maybe they are a silicon!
else
receiver_mob = get(computer, /mob/living/silicon)
var/list/mob/living/receievers = list()
if(computer.inserted_pai)
receievers += computer.inserted_pai.pai
if(computer.loc && isliving(computer.loc))
receievers += computer.loc
var/should_ring = !alert_silenced || is_rigged
if(should_ring && istype(receiver_mob) && receiver_mob.is_literate() && (receiver_mob.stat == CONSCIOUS || receiver_mob.stat == SOFT_CRIT))
for(var/mob/living/messaged_mob as anything in receievers)
if(messaged_mob.stat >= UNCONSCIOUS)
continue
if(!messaged_mob.is_literate())
continue
var/reply_href = signal.data["rigged"] ? "explode" : "message"
var/photo_href = signal.data["rigged"] ? "explode" : "open"
var/reply
@@ -676,16 +676,16 @@
var/sender_title = is_fake_user ? STRINGIFY_PDA_TARGET(fake_name, fake_job) : get_messenger_name(sender_messenger)
var/sender_name = is_fake_user ? fake_name : sender_messenger.computer.saved_identification
if (isAI(receiver_mob))
sender_title = "<a href='?src=[REF(receiver_mob)];track=[html_encode(sender_name)]'>[sender_title]</a>"
if (isAI(messaged_mob))
sender_title = "<a href='?src=[REF(messaged_mob)];track=[html_encode(sender_name)]'>[sender_title]</a>"
var/inbound_message = "[signal.format_message()]"
inbound_message = emoji_parse(inbound_message)
var/photo_message = signal.data["photo"] ? " (<a href='byond://?src=[REF(src)];choice=[photo_href];skiprefresh=1;target=[REF(chat)]'>Photo Attached</a>)" : ""
to_chat(receiver_mob, span_infoplain("[icon2html(computer, receiver_mob)] <b>PDA message from [sender_title], </b>\"[inbound_message]\"[photo_message] [reply]"))
to_chat(messaged_mob, span_infoplain("[icon2html(computer, messaged_mob)] <b>PDA message from [sender_title], </b>\"[inbound_message]\"[photo_message] [reply]"))
if (alert_able && should_ring)
if (alert_able && (!alert_silenced || is_rigged))
computer.ring(ringtone)
SStgui.update_uis(computer)