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 a32c521902..a2c3248c6a 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(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 + 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///////////////////////////////////////////////////////////////////