mirror of
https://github.com/quotefox/Hyper-Station-13.git
synced 2026-08-29 23:56:18 +01:00
Prevent multiple AI PDAs
Adds check for AI shell borg before setting up a built-in-PDA. Ensures AIs using their PDA while in a borg shell links properly, and that checks for distance between the built-in pda and the AI using it is bypassed.
This commit is contained in:
@@ -113,8 +113,8 @@
|
||||
/obj/screen/ai/pda_msg_send/Click()
|
||||
if(..())
|
||||
return
|
||||
var/mob/living/silicon/ai/AI = usr
|
||||
AI.cmd_send_pdamesg(usr)
|
||||
var/mob/living/silicon/S = usr
|
||||
S.cmd_send_pdamesg(usr, TRUE)
|
||||
|
||||
/obj/screen/ai/pda_msg_show
|
||||
name = "PDA - Show Message Log"
|
||||
@@ -123,8 +123,8 @@
|
||||
/obj/screen/ai/pda_msg_show/Click()
|
||||
if(..())
|
||||
return
|
||||
var/mob/living/silicon/ai/AI = usr
|
||||
AI.cmd_show_message_log(usr)
|
||||
var/mob/living/silicon/S = usr
|
||||
S.cmd_show_message_log(usr)
|
||||
|
||||
/obj/screen/ai/image_take
|
||||
name = "Take Image"
|
||||
|
||||
@@ -738,8 +738,9 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
if((last_text && world.time < last_text + 10) || (everyone && last_everyone && world.time < last_everyone + PDA_SPAM_DELAY))
|
||||
return
|
||||
var/emoji_message = emoji_parse(message)
|
||||
if(prob(1))
|
||||
message += "\nSent from my PDA"
|
||||
//Bad for RP
|
||||
//if(prob(1))
|
||||
// message += "\nSent from my PDA"
|
||||
// Send the signal
|
||||
var/list/string_targets = list()
|
||||
for (var/obj/item/pda/P in targets)
|
||||
@@ -796,7 +797,7 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
|
||||
if (!silent)
|
||||
if(prob(0.1))
|
||||
playsound(src, 'sound/machines/youve_got_mail.ogg', 50, 1)
|
||||
playsound(src, 'sound/machines/youve_got_mail.ogg', 50, 0)
|
||||
audible_message("[icon2html(src, hearers(src))] *You've got mail!*", null, 3)
|
||||
else
|
||||
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
@@ -1071,8 +1072,7 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
QDEL_NULL(inserted_item)
|
||||
return ..()
|
||||
|
||||
//AI verb and proc for sending PDA messages.
|
||||
|
||||
//Silicon verb and proc for sending PDA messages.
|
||||
/mob/living/silicon/proc/cmd_send_pdamesg(mob/user)
|
||||
var/list/plist = list()
|
||||
var/list/namecounts = list()
|
||||
@@ -1082,11 +1082,8 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
return
|
||||
|
||||
for (var/obj/item/pda/P in get_viewable_pdas())
|
||||
if (P == src)
|
||||
if (P == builtInPDA)//Don't want to send messages to yourself
|
||||
continue
|
||||
else if (P == builtInPDA)
|
||||
continue
|
||||
|
||||
plist[avoid_assoc_duplicate_keys(P.owner, namecounts)+" ("+P.ownjob+")"] = P
|
||||
|
||||
var/c = input(user, "Please select a PDA") as null|anything in sortList(plist)
|
||||
@@ -1134,6 +1131,7 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
/mob/living/silicon/proc/cmd_show_message_log(mob/user)
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
if(!isnull(builtInPDA))
|
||||
var/HTML = "<html><head><title>PDA Message Log</title></head><body>[builtInPDA.tnote]</body></html>"
|
||||
user << browse(HTML, "window=log;size=400x444;border=1;can_resize=1;can_close=1;can_minimize=0")
|
||||
@@ -1154,6 +1152,7 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
|
||||
/proc/get_viewable_pdas()
|
||||
. = list()
|
||||
|
||||
// Returns a list of PDAs which can be viewed from another PDA/message monitor.
|
||||
for(var/obj/item/pda/P in GLOB.PDAs)
|
||||
if(!P.owner || P.toff || P.hidden)
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
builtInPDA = new/obj/item/pda/ai(src)
|
||||
builtInPDA.owner = name
|
||||
builtInPDA.ownjob = "AI"
|
||||
builtInPDA.name = name + " (" + builtInPDA.ownjob + ")"
|
||||
builtInPDA.update_label()
|
||||
|
||||
aiMulti = new(src)
|
||||
radio = new /obj/item/radio/headset/ai(src)
|
||||
@@ -799,7 +799,7 @@
|
||||
if(control_disabled || incapacitated())
|
||||
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
|
||||
return FALSE
|
||||
if(be_close && !in_range(M, src))
|
||||
if(be_close && !in_range(M, src) && M != builtInPDA) //Makes sure AIs in shells can always use their PDA. This one probably unnecessary since it's called from robot.dm, but just in case.
|
||||
to_chat(src, "<span class='warning'>You are too far away!</span>")
|
||||
return FALSE
|
||||
return can_see(M) //stop AIs from leaving windows open and using then after they lose vision
|
||||
|
||||
@@ -143,6 +143,11 @@
|
||||
if(wires.is_cut(WIRE_CAMERA))
|
||||
builtInCamera.status = 0
|
||||
|
||||
module = new /obj/item/robot_module(src)
|
||||
module.rebuild_modules()
|
||||
update_icons()
|
||||
. = ..()
|
||||
|
||||
//If this body is meant to be a borg controlled by the AI player
|
||||
if(shell)
|
||||
make_shell()
|
||||
@@ -161,17 +166,12 @@
|
||||
|
||||
updatename()
|
||||
|
||||
//Name updated, can build PDA data now
|
||||
if(!builtInPDA)
|
||||
//Name updated, can build PDA data now. Checks for if AI is meant to control.
|
||||
if(!builtInPDA && !shell)
|
||||
builtInPDA = new/obj/item/pda/ai(src)
|
||||
builtInPDA.owner = name
|
||||
builtInPDA.ownjob = "Station Cyborg"
|
||||
builtInPDA.name = name + " (" + builtInPDA.ownjob + ")"
|
||||
|
||||
module = new /obj/item/robot_module(src)
|
||||
module.rebuild_modules()
|
||||
update_icons()
|
||||
. = ..()
|
||||
builtInPDA.update_label()
|
||||
|
||||
equippable_hats = typecacheof(equippable_hats)
|
||||
|
||||
@@ -939,7 +939,7 @@
|
||||
if(stat || lockcharge || low_power_mode)
|
||||
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
|
||||
return FALSE
|
||||
if(be_close && !in_range(M, src))
|
||||
if(be_close && !in_range(M, src) && M != builtInPDA) //Makes sure AIs in shells can always use their PDA
|
||||
to_chat(src, "<span class='warning'>You are too far away!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
@@ -1149,6 +1149,10 @@
|
||||
mainframe.connected_robots |= src
|
||||
lawupdate = TRUE
|
||||
lawsync()
|
||||
|
||||
//Ensures AI shells have the same PDA as their mainframe AI
|
||||
builtInPDA = AI.builtInPDA
|
||||
|
||||
if(radio && AI.radio) //AI keeps all channels, including Syndie if it is a Traitor
|
||||
if(AI.radio.syndie)
|
||||
radio.make_syndie()
|
||||
|
||||
Reference in New Issue
Block a user