Skip to content

Commit

Permalink
[MIRROR] Moves the new "Turn Target into MMI" verb into a VV dropdown…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
Co-authored-by: Timberpoes <[email protected]>
Co-authored-by: Iajret <[email protected]>
  • Loading branch information
4 people authored Dec 4, 2023
1 parent a2d2f58 commit fdae437
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 15 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 0 additions & 15 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
56 changes: 56 additions & 0 deletions code/modules/mob/living/brain/MMI.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
27 changes: 27 additions & 0 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fdae437

Please sign in to comment.