mirror of
https://github.com/quotefox/Hyper-Station-13.git
synced 2026-07-19 11:42:27 +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:
@@ -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