From 50357cb9d6498af8333cba608bdd95b4efe60642 Mon Sep 17 00:00:00 2001
From: zxaber <37497534+zxaber@users.noreply.github.com>
Date: Thu, 21 Jan 2021 12:04:31 -0800
Subject: [PATCH] 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.
---
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 9eadec2ba93..350218bcf4a 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -1099,9 +1099,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.")