From 96d46ca0e41f3689cb67231a6df206f4fbfe35f9 Mon Sep 17 00:00:00 2001 From: Maxim Nikitin Date: Fri, 2 Oct 2020 12:03:24 -0400 Subject: [PATCH 1/3] Makes the slimeperson swap-body UI stay open when you switch bodies --- .../carbon/human/species_types/jellypeople.dm | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index 38f3111a23..c9add21b3d 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -274,7 +274,17 @@ \"steps out\" of [H.p_them()].", "...and after a moment of disorentation, \ you're besides yourself!") - + if(H != spare && isslimeperson(spare) && isslimeperson(H)) + // transfer the swap-body ui if it's open + var/datum/action/innate/swap_body/this_swap = origin_datum.swap_body + var/datum/action/innate/swap_body/other_swap = spare_datum.swap_body + var/datum/tgui/ui = SStgui.get_open_ui(old, this_swap, "main") || SStgui.get_open_ui(dupe, this_swap, "main") + if(ui) + SStgui.on_close(ui) // basically removes it from lists is all this proc does. + ui.user = spare + ui.src_object = other_swap + SStgui.on_open(ui) // stick it back on the lists + ui.process(force = TRUE) /datum/action/innate/swap_body name = "Swap Body" @@ -327,6 +337,8 @@ stat = "Conscious" if(UNCONSCIOUS) stat = "Unconscious" + if(SOFT_CRIT) + stat = "Barely Conscious" if(DEAD) stat = "Dead" var/occupied @@ -373,7 +385,6 @@ var/mob/living/carbon/human/selected = locate(params["ref"]) in SS.bodies if(!can_swap(selected)) return - SStgui.close_uis(src) swap_to_dupe(H.mind, selected) /datum/action/innate/swap_body/proc/can_swap(mob/living/carbon/human/dupe) @@ -407,6 +418,7 @@ /datum/action/innate/swap_body/proc/swap_to_dupe(datum/mind/M, mob/living/carbon/human/dupe) if(!can_swap(dupe)) //sanity check return + var/mob/living/carbon/human/old = M.current if(M.current.stat == CONSCIOUS) M.current.visible_message("[M.current] \ stops moving and starts staring vacantly into space.", @@ -418,7 +430,20 @@ dupe.visible_message("[dupe] blinks and looks \ around.", "...and move this one instead.") - + if(old != M.current && dupe == M.current && isslimeperson(dupe)) + var/datum/species/jelly/slime/other_spec = dupe.dna.species + var/datum/action/innate/swap_body/other_swap = other_spec.swap_body + // theoretically the transfer_to proc is supposed to transfer the ui from the mob. + // so I try to get the UI from one of the two mobs and schlump it over to the new action button + var/datum/tgui/ui = SStgui.get_open_ui(old, src, "main") || SStgui.get_open_ui(dupe, src, "main") + if(ui) + // transfer the UI over. This code is slightly hacky but it fixes the problem + // I'd use SStgui.on_transfer but that doesn't let you transfer the src_object as well s + SStgui.on_close(ui) // basically removes it from lists is all this proc does. + ui.user = dupe + ui.src_object = other_swap + SStgui.on_open(ui) // stick it back on the lists + ui.process(force = TRUE) ////////////////////////////////////////////////////////Round Start Slimes/////////////////////////////////////////////////////////////////// From 64b4abca4bb114ef4b257aa04a7ca71f56b567f1 Mon Sep 17 00:00:00 2001 From: Maxim Nikitin Date: Fri, 2 Oct 2020 12:05:05 -0400 Subject: [PATCH 2/3] oopsie --- .../mob/living/carbon/human/species_types/jellypeople.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index c9add21b3d..4378d4d2eb 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -242,7 +242,8 @@ H.mob_transforming = FALSE -/datum/action/innate/split_body/proc/make_dupe() +/datum/action/innate/split_body/proc/make_ +() var/mob/living/carbon/human/H = owner CHECK_DNA_AND_SPECIES(H) @@ -278,7 +279,7 @@ // transfer the swap-body ui if it's open var/datum/action/innate/swap_body/this_swap = origin_datum.swap_body var/datum/action/innate/swap_body/other_swap = spare_datum.swap_body - var/datum/tgui/ui = SStgui.get_open_ui(old, this_swap, "main") || SStgui.get_open_ui(dupe, this_swap, "main") + var/datum/tgui/ui = SStgui.get_open_ui(H, this_swap, "main") || SStgui.get_open_ui(spare, this_swap, "main") if(ui) SStgui.on_close(ui) // basically removes it from lists is all this proc does. ui.user = spare From 4b6870ed1b9fdf5c586bfd2187dfb3de92f906f1 Mon Sep 17 00:00:00 2001 From: Maxim Nikitin Date: Fri, 2 Oct 2020 12:07:09 -0400 Subject: [PATCH 3/3] the fuck --- .../mob/living/carbon/human/species_types/jellypeople.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index 4378d4d2eb..acf1dc1ef9 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -242,8 +242,7 @@ H.mob_transforming = FALSE -/datum/action/innate/split_body/proc/make_ -() +/datum/action/innate/split_body/proc/make_dupe() var/mob/living/carbon/human/H = owner CHECK_DNA_AND_SPECIES(H)