Allows admins to cryo cyborgs and AI's in player panel (#16418)

* Allows admins to cryo cyborgs and AI's

* Apply suggestions from code review

Co-authored-by: SabreML <57483089+SabreML@users.noreply.github.com>

* More requested changes

* Better cryoing and runtiming

Co-authored-by: SabreML <57483089+SabreML@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2021-08-06 13:50:10 -04:00
committed by GitHub
parent 9bf4d7ad84
commit 2ba2c20a4f
4 changed files with 37 additions and 21 deletions
+5 -4
View File
@@ -758,8 +758,7 @@
var/mob/living/silicon/robot/R = occupant
if(!istype(R)) return ..()
R.contents -= R.mmi
qdel(R.mmi)
QDEL_NULL(R.mmi)
for(var/obj/item/I in R.module) // the tools the borg has; metal, glass, guns etc
for(var/obj/item/O in I) // the things inside the tools, if anything; mainly for janiborg trash bags
O.loc = R
@@ -771,7 +770,7 @@
return ..()
/proc/cryo_ssd(mob/living/carbon/person_to_cryo)
/proc/cryo_ssd(mob/living/person_to_cryo)
if(istype(person_to_cryo.loc, /obj/machinery/cryopod))
return 0
if(isobj(person_to_cryo.loc))
@@ -779,7 +778,9 @@
O.force_eject_occupant(person_to_cryo)
var/list/free_cryopods = list()
for(var/obj/machinery/cryopod/P in GLOB.machines)
if(!P.occupant && istype(get_area(P), /area/crew_quarters/sleep))
if(P.occupant)
continue
if((ishuman(person_to_cryo) && istype(get_area(P), /area/crew_quarters/sleep)) || istype(P, /obj/machinery/cryopod/robot))
free_cryopods += P
var/obj/machinery/cryopod/target_cryopod = null
if(free_cryopods.len)
+29 -15
View File
@@ -2300,26 +2300,40 @@
else if(href_list["cryossd"])
if(!check_rights(R_ADMIN))
return
var/mob/living/carbon/human/H = locateUID(href_list["cryossd"])
if(!istype(H))
to_chat(usr, "<span class='warning'>This can only be used on instances of type /mob/living/carbon/human</span>")
var/mob/living/M = locateUID(href_list["cryossd"])
var/human = ishuman(M)
if(!human && !issilicon(M))
to_chat(usr, "<span class='warning'>This can only be used on humans and silicons.</span>")
return
if(!href_list["cryoafk"] && !isLivingSSD(H))
if(!href_list["cryoafk"] && !isLivingSSD(M))
to_chat(usr, "<span class='warning'>This can only be used on living, SSD players.</span>")
return
if(istype(H.loc, /obj/machinery/cryopod))
var/obj/machinery/cryopod/P = H.loc
if(isAI(M))
var/mob/living/silicon/ai/A = M
A.cryo_AI()
if(istype(M.loc, /obj/machinery/cryopod))
var/obj/machinery/cryopod/P = M.loc
P.despawn_occupant()
log_admin("[key_name(usr)] despawned [H.job] [H] in cryo.")
message_admins("[key_name_admin(usr)] despawned [H.job] [H] in cryo.")
else if(cryo_ssd(H))
log_admin("[key_name(usr)] sent [H.job] [H] to cryo.")
message_admins("[key_name_admin(usr)] sent [H.job] [H] to cryo.")
if(human)
var/mob/living/carbon/human/H = M
log_admin("[key_name(usr)] despawned [H.job] [H] in cryo.")
message_admins("[key_name_admin(usr)] despawned [H.job] [H] in cryo.")
else //robot
log_admin("[key_name(usr)] despawned [M] in cryo.")
message_admins("[key_name_admin(usr)] despawned [M] in cryo.")
else if(cryo_ssd(M))
if(human)
var/mob/living/carbon/human/H = M
log_admin("[key_name(usr)] sent [H.job] [H] to cryo.")
message_admins("[key_name_admin(usr)] sent [H.job] [H] to cryo.")
else
log_admin("[key_name(usr)] sent [M] to cryo.")
message_admins("[key_name_admin(usr)] sent [M] to cryo.")
if(href_list["cryoafk"]) // Warn them if they are send to storage and are AFK
to_chat(H, "<span class='danger'>The admins have moved you to cryo storage for being AFK. Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned.</span>")
SEND_SOUND(H, sound('sound/effects/adminhelp.ogg'))
if(H.client)
window_flash(H.client)
to_chat(M, "<span class='danger'>The admins have moved you to cryo storage for being AFK. Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned.</span>")
SEND_SOUND(M, sound('sound/effects/adminhelp.ogg'))
if(M.client)
window_flash(M.client)
else if(href_list["FaxReplyTemplate"])
if(!check_rights(R_ADMIN))
return
@@ -9,8 +9,9 @@ GLOBAL_LIST_EMPTY(empty_playable_ai_cores)
if(alert("WARNING: This will immediately wipe your core and ghost you, removing your character from the round permanently (similar to cryo and robotic storage). Are you entirely sure you want to do this?",
"Wipe Core", "No", "No", "Yes") != "Yes")
return
cryo_AI()
// We warned you.
/mob/living/silicon/ai/proc/cryo_AI()
GLOB.empty_playable_ai_cores += new /obj/structure/AIcore/deactivated(loc)
GLOB.global_announcer.autosay("[src] has been moved to intelligence storage.", "Artificial Intelligence Oversight")
@@ -284,7 +284,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
else
to_chat(src, "<span class='boldannounce'>Oops! Something went very wrong, your MMI was unable to receive your mind. You have been ghosted. Please make a bug report so we can fix this bug.</span>")
ghostize()
error("A borg has been destroyed, but its MMI lacked a brainmob, so the mind could not be transferred. Player: [ckey].")
log_runtime(EXCEPTION("A borg has been destroyed, but its MMI lacked a brainmob, so the mind could not be transferred. Player: [ckey]."), src)
mmi = null
if(connected_ai)
connected_ai.connected_robots -= src