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:
haha26315
2022-09-15 16:37:46 -04:00
parent 8b04cb4fc1
commit 2e1262c140
4 changed files with 27 additions and 24 deletions
+2 -2
View File
@@ -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
+13 -9
View File
@@ -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()