From fdae437273975482694b5490d8d5ef54aa71feec Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+Steals-The-PRs@users.noreply.github.com> Date: Mon, 4 Dec 2023 12:23:14 +0300 Subject: [PATCH] [MIRROR] Moves the new "Turn Target into MMI" verb into a VV dropdown option and rewrites the code around it. [MDB IGNORE] (#964) * Moves the new "Turn Target into MMI" verb into a VV dropdown option and rewrites the code around it. (#80097) --------- Co-authored-by: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Co-authored-by: Timberpoes Co-authored-by: Iajret --- code/__DEFINES/vv.dm | 1 + code/modules/admin/admin_verbs.dm | 15 ----- code/modules/mob/living/brain/MMI.dm | 56 +++++++++++++++++++ code/modules/mob/living/carbon/human/human.dm | 27 +++++++++ 4 files changed, 84 insertions(+), 15 deletions(-) diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm index 039533cffa5..133b191e5ec 100644 --- a/code/__DEFINES/vv.dm +++ b/code/__DEFINES/vv.dm @@ -153,6 +153,7 @@ #define VV_HK_SET_SPECIES "setspecies" #define VV_HK_PURRBATION "purrbation" #define VV_HK_APPLY_DNA_INFUSION "apply_dna_infusion" +#define VV_HK_TURN_INTO_MMI "turn_into_mmi" // misc #define VV_HK_SPACEVINE_PURGE "spacevine_purge" diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 979c42b9d79..30bb5ff4ffe 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -248,7 +248,6 @@ GLOBAL_PROTECT(admin_verbs_debug) /client/proc/run_empty_query, /client/proc/SDQL2_query, /client/proc/set_dynex_scale, - /client/proc/spawn_as_mmi, /client/proc/spawn_debug_full_crew, /client/proc/test_cardpack_distribution, /client/proc/test_movable_UI, @@ -1230,17 +1229,3 @@ GLOBAL_PROTECT(admin_verbs_poll) segment.AddComponent(/datum/component/mob_chain, front = previous) previous = segment -/client/proc/spawn_as_mmi(mob/living/carbon/human/target in GLOB.human_list) - set category = "Debug" - set name = "Turn target into MMI" - set desc = "Turns something into an MMI, must be used on humans" - if(!check_rights(R_DEBUG)) - return - if(!ishuman(target)) - return - - var/obj/item/mmi/new_mmi = new(target.loc) - var/obj/item/organ/internal/brain/target_brain = target.get_organ_slot(ORGAN_SLOT_BRAIN) - target_brain.Remove(target) - new_mmi.attackby(target_brain,target) - qdel(target) diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index b63ca68d7d7..663da2ee8a8 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -111,6 +111,62 @@ else return ..() +/** + * Forces target brain into the MMI. Mainly intended for admin purposes, as this allows transfer without a mob or user. + * + * Returns FALSE on failure, TRUE on success. + * + * Arguments: + * * new_brain - Brain to be force-inserted into the MMI. Any calling code should handle proper removal of the brain from the mob, as this proc only forceMoves. + */ +/obj/item/mmi/proc/force_brain_into(obj/item/organ/internal/brain/new_brain) + if(isnull(new_brain)) + stack_trace("Proc called with null brain.") + return FALSE + + if(!istype(new_brain)) + stack_trace("Proc called with invalid type: [new_brain] ([new_brain.type])") + return FALSE + + if(isnull(new_brain.brainmob)) + new_brain.forceMove(src) + brain = new_brain + brain.organ_flags |= ORGAN_FROZEN + name = "[initial(name)]: [copytext(new_brain.name, 1, -8)]" + update_appearance() + return TRUE + + new_brain.forceMove(src) + + var/mob/living/brain/new_brain_brainmob = new_brain.brainmob + if(!new_brain_brainmob.key && !new_brain.decoy_override) + new_brain_brainmob.notify_ghost_cloning("Someone has put your brain in a MMI!", source = src) + + set_brainmob(new_brain_brainmob) + new_brain.brainmob = null + brainmob.forceMove(src) + brainmob.container = src + + var/fubar_brain = new_brain.suicided || HAS_TRAIT(brainmob, TRAIT_SUICIDED) + if(!fubar_brain && !(new_brain.organ_flags & ORGAN_FAILING)) + brainmob.set_stat(CONSCIOUS) + + brainmob.reset_perspective() + brain = new_brain + brain.organ_flags |= ORGAN_FROZEN + + name = "[initial(name)]: [brainmob.real_name]" + + update_appearance() + if(istype(brain, /obj/item/organ/internal/brain/alien)) + braintype = "Xenoborg" + else + braintype = "Cyborg" + + SSblackbox.record_feedback("amount", "mmis_filled", 1) + + return TRUE + /obj/item/mmi/attack_self(mob/user) if(!brain) radio.set_on(!radio.is_on()) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 33f2925d19e..c0900ed5a33 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -789,6 +789,7 @@ VV_DROPDOWN_OPTION(VV_HK_SET_SPECIES, "Set Species") VV_DROPDOWN_OPTION(VV_HK_PURRBATION, "Toggle Purrbation") VV_DROPDOWN_OPTION(VV_HK_APPLY_DNA_INFUSION, "Apply DNA Infusion") + VV_DROPDOWN_OPTION(VV_HK_TURN_INTO_MMI, "Turn into MMI") /mob/living/carbon/human/vv_do_topic(list/href_list) . = ..() @@ -889,6 +890,32 @@ to_chat(usr, "Failed to apply DNA Infusion to [src].") log_admin("[key_name(usr)] failed to apply a DNA Infusion to [key_name(src)].") + if(href_list[VV_HK_TURN_INTO_MMI]) + if(!check_rights(R_DEBUG)) + return + + var/result = input(usr, "This will delete the mob, are you sure?", "Turn into MMI") in list("Yes", "No") + if(result != "Yes") + return + + var/obj/item/organ/internal/brain/target_brain = get_organ_slot(ORGAN_SLOT_BRAIN) + + if(isnull(target_brain)) + to_chat(usr, "This mob has no brain to insert into an MMI.") + return + + var/obj/item/mmi/new_mmi = new(get_turf(src)) + + target_brain.Remove(src) + new_mmi.force_brain_into(target_brain) + + to_chat(usr, "Turned [src] into an MMI.") + log_admin("[key_name(usr)] turned [key_name_and_tag(src)] into an MMI.") + + qdel(src) + + + /mob/living/carbon/human/limb_attack_self() var/obj/item/bodypart/arm = hand_bodyparts[active_hand_index] if(arm)