From e8fde9de6de069fe8bad3a14ae1bc12f4912182a Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Fri, 22 Jan 2021 05:06:50 +0100
Subject: [PATCH] [MIRROR] Admins transforming a humanoid into an AI can now
choose to not move them to the satellite. (#2826)
* Admins transforming a humanoid into an AI can now choose to not move them to the satellite. (#56075)
Adds a Yes/No/Cancel button to the AI transform proc that admins use on whether the new AI should be moved to the satellite or not.
Sometimes admins want to make an AI somewhere off-station for whatever reason. Also makes testing things with AIs less of a hassle.
* Admins transforming a humanoid into an AI can now choose to not move them to the satellite.
Co-authored-by: zxaber <37497534+zxaber@users.noreply.github.com>
---
code/modules/admin/topic.dm | 11 ++++++++++-
code/modules/mob/transform_procs.dm | 26 +++++++++++++++-----------
2 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 1323c27be83..59a514e1a0c 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -1105,9 +1105,18 @@
to_chat(usr, "This can only be used on instances of type /mob/living/carbon/human.", confidential = TRUE)
return
+ var/move = TRUE
+ switch(alert(usr,"Move new AI to AI spawn location?","Move AI?", "Yes", "No","Cancel"))
+ if("Cancel")
+ return
+ if("No")
+ move = FALSE
+ if(QDELETED(H))
+ to_chat(usr, "Subject was deleted already. Transform canceled.")
+ return
message_admins("Admin [key_name_admin(usr)] AIized [key_name_admin(H)]!")
log_admin("[key_name(usr)] AIized [key_name(H)].")
- H.AIize(TRUE, H.client)
+ H.AIize(TRUE, H.client, move)
else if(href_list["makealien"])
if(!check_rights(R_SPAWN))
diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm
index 95aa443b25a..93700e92bc8 100644
--- a/code/modules/mob/transform_procs.dm
+++ b/code/modules/mob/transform_procs.dm
@@ -77,20 +77,24 @@
invisibility = INVISIBILITY_MAXIMUM
return ..()
-/mob/proc/AIize(transfer_after = TRUE, client/preference_source)
+/mob/proc/AIize(transfer_after = TRUE, client/preference_source, move = TRUE)
var/list/turf/landmark_loc = list()
- for(var/obj/effect/landmark/start/ai/sloc in GLOB.landmarks_list)
- if(locate(/mob/living/silicon/ai) in sloc.loc)
- continue
- if(sloc.primary_ai)
- LAZYCLEARLIST(landmark_loc)
- landmark_loc += sloc.loc
- break
- landmark_loc += sloc.loc
- if(!landmark_loc.len)
- to_chat(src, "Oh god sorry we can't find an unoccupied AI spawn location, so we're spawning you on top of someone.")
+
+ if(!move)
+ landmark_loc += loc
+ else
for(var/obj/effect/landmark/start/ai/sloc in GLOB.landmarks_list)
+ if(locate(/mob/living/silicon/ai) in sloc.loc)
+ continue
+ if(sloc.primary_ai)
+ LAZYCLEARLIST(landmark_loc)
+ landmark_loc += sloc.loc
+ break
landmark_loc += sloc.loc
+ if(!landmark_loc.len)
+ to_chat(src, "Oh god sorry we can't find an unoccupied AI spawn location, so we're spawning you on top of someone.")
+ for(var/obj/effect/landmark/start/ai/sloc in GLOB.landmarks_list)
+ landmark_loc += sloc.loc
if(!landmark_loc.len)
message_admins("Could not find ai landmark for [src]. Yell at a mapper! We are spawning them at their current location.")