From 1bd78fed17518f4ebb150f8723d44dfdfc5d924c Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Fri, 5 Jan 2024 23:49:28 +0000 Subject: [PATCH 1/4] evolute --- .../mob/living/carbon/xenomorph/Evolution.dm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/code/modules/mob/living/carbon/xenomorph/Evolution.dm b/code/modules/mob/living/carbon/xenomorph/Evolution.dm index d6f963747e33..67a1407a5567 100644 --- a/code/modules/mob/living/carbon/xenomorph/Evolution.dm +++ b/code/modules/mob/living/carbon/xenomorph/Evolution.dm @@ -158,6 +158,8 @@ if(new_xeno.client) new_xeno.client.change_view(GLOB.world_view_size) + evolve_ui_transfer(new_xeno) + //Regenerate the new mob's name now that our player is inside new_xeno.generate_name() if(new_xeno.client) @@ -348,6 +350,8 @@ new_xeno.client.pixel_x = 0 new_xeno.client.pixel_y = 0 + evolve_ui_transfer(new_xeno) + //Regenerate the new mob's name now that our player is inside new_xeno.generate_name() if(new_xeno.client) @@ -401,3 +405,13 @@ return FALSE return TRUE + +// Transfer over any open TGUIs after evolving to the new body. +/mob/living/carbon/xenomorph/proc/evolve_ui_transfer(mob/living/carbon/xenomorph/new_xeno) + SStgui.on_transfer(src, new_xeno) + + // If the user has the tacmap in their `screen_maps` list. + var/atom/movable/screen/minimap/xeno_tacmap_screen_obj = hive.tacmap.map_holder.map + if(new_xeno.client.screen_maps[xeno_tacmap_screen_obj.assigned_map]) + // Re-register the map object with the client and add it to their `screen`. + new_xeno.client.register_map_obj(xeno_tacmap_screen_obj) From d74621e62dc8db7000d5d4524b97cd2a2b518af7 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Mon, 8 Jan 2024 20:37:57 +0000 Subject: [PATCH 2/4] Revert "evolute" This reverts commit 1bd78fed17518f4ebb150f8723d44dfdfc5d924c. --- .../mob/living/carbon/xenomorph/Evolution.dm | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/code/modules/mob/living/carbon/xenomorph/Evolution.dm b/code/modules/mob/living/carbon/xenomorph/Evolution.dm index 67a1407a5567..d6f963747e33 100644 --- a/code/modules/mob/living/carbon/xenomorph/Evolution.dm +++ b/code/modules/mob/living/carbon/xenomorph/Evolution.dm @@ -158,8 +158,6 @@ if(new_xeno.client) new_xeno.client.change_view(GLOB.world_view_size) - evolve_ui_transfer(new_xeno) - //Regenerate the new mob's name now that our player is inside new_xeno.generate_name() if(new_xeno.client) @@ -350,8 +348,6 @@ new_xeno.client.pixel_x = 0 new_xeno.client.pixel_y = 0 - evolve_ui_transfer(new_xeno) - //Regenerate the new mob's name now that our player is inside new_xeno.generate_name() if(new_xeno.client) @@ -405,13 +401,3 @@ return FALSE return TRUE - -// Transfer over any open TGUIs after evolving to the new body. -/mob/living/carbon/xenomorph/proc/evolve_ui_transfer(mob/living/carbon/xenomorph/new_xeno) - SStgui.on_transfer(src, new_xeno) - - // If the user has the tacmap in their `screen_maps` list. - var/atom/movable/screen/minimap/xeno_tacmap_screen_obj = hive.tacmap.map_holder.map - if(new_xeno.client.screen_maps[xeno_tacmap_screen_obj.assigned_map]) - // Re-register the map object with the client and add it to their `screen`. - new_xeno.client.register_map_obj(xeno_tacmap_screen_obj) From e79c73730616278fb240d0c1edac988d004104b8 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Tue, 9 Jan 2024 01:27:37 +0000 Subject: [PATCH 3/4] evolutification Using the `COMSIG_MIND_TRANSFERRED` signal here (stolen from TG of course) rather than `COMSIG_MOB_NEW_MIND` so that the UI doesn't need to unregister from the old body and re-register with the new one. --- code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm | 2 ++ code/controllers/subsystem/minimap.dm | 10 ++++++++++ code/datums/mind.dm | 3 +++ code/modules/mob/dead/observer/observer.dm | 1 - colonialmarines.dme | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm diff --git a/code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm b/code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm new file mode 100644 index 000000000000..e807a38cedd1 --- /dev/null +++ b/code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm @@ -0,0 +1,2 @@ +///from mind/transfer_to. Sent after the mind has been transferred: (mob/previous_body) +#define COMSIG_MIND_TRANSFERRED "mind_transferred" diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index a808e7e3fd85..66c42e3b5b3a 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -683,6 +683,7 @@ SUBSYSTEM_DEF(minimaps) user.client.register_map_obj(map_holder.map) ui = new(user, src, "TacticalMap") ui.open() + RegisterSignal(user.mind, COMSIG_MIND_TRANSFERRED, PROC_REF(on_mind_transferred)) /datum/tacmap/drawing/tgui_interact(mob/user, datum/tgui/ui) var/mob/living/carbon/xenomorph/xeno = user @@ -721,6 +722,7 @@ SUBSYSTEM_DEF(minimaps) tacmap_ready_time = SSminimaps.next_fire + 2 SECONDS addtimer(CALLBACK(src, PROC_REF(on_tacmap_fire), faction), SSminimaps.next_fire - world.time + 1 SECONDS) user.client.register_map_obj(map_holder.map) + RegisterSignal(user.mind, COMSIG_MIND_TRANSFERRED, PROC_REF(on_mind_transferred)) ui = new(user, src, "TacticalMap") ui.open() @@ -806,6 +808,9 @@ SUBSYSTEM_DEF(minimaps) return data +/datum/tacmap/ui_close(mob/user) + UnregisterSignal(user.mind, COMSIG_MIND_TRANSFERRED) + /datum/tacmap/drawing/ui_close(mob/user) . = ..() action_queue_change = 0 @@ -934,6 +939,11 @@ SUBSYSTEM_DEF(minimaps) return UI_INTERACTIVE +// This gets removed when the player changes bodies (i.e. xeno evolution), so re-register it when that happens. +/datum/tacmap/proc/on_mind_transferred(datum/mind/source, mob/previous_body) + SIGNAL_HANDLER + source.current.client.register_map_obj(map_holder.map) + /datum/tacmap_holder var/map_ref var/atom/movable/screen/minimap/map diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 74f445f21597..945f4d0a5351 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -44,9 +44,11 @@ msg_admin_niche("[key]/[ckey] has tried to transfer to deleted [new_character].") return + var/mob/old_current = current if(current) current.mind = null //remove ourself from our old body's mind variable SSnano.nanomanager.user_transferred(current, new_character) // transfer active NanoUI instances to new user + SStgui.on_transfer(current, new_character) // and active TGUI instances if(key) if(new_character.key != key) @@ -76,6 +78,7 @@ continue player_entity = setup_player_entity(ckey) + SEND_SIGNAL(src, COMSIG_MIND_TRANSFERRED, old_current) SEND_SIGNAL(new_character, COMSIG_MOB_NEW_MIND, current.client) new_character.refresh_huds(current) //inherit the HUDs from the old body diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 3108a09e62b5..ad5efc7da3a0 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -621,7 +621,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return mind.transfer_to(mind.original, TRUE) - SStgui.on_transfer(src, mind.current) qdel(src) return TRUE diff --git a/colonialmarines.dme b/colonialmarines.dme index ec330db86a4d..fa4120134e60 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -135,6 +135,7 @@ #include "code\__DEFINES\dcs\signals\atom\signals_obj.dm" #include "code\__DEFINES\dcs\signals\atom\signals_projectile.dm" #include "code\__DEFINES\dcs\signals\atom\signals_turf.dm" +#include "code\__DEFINES\dcs\signals\atom\mob\signals_mind.dm" #include "code\__DEFINES\dcs\signals\atom\mob\signals_mob.dm" #include "code\__DEFINES\dcs\signals\atom\mob\living\signals_human.dm" #include "code\__DEFINES\dcs\signals\atom\mob\living\signals_living.dm" From 51bafe9ce16e285e1aca9921cc946dca6c69cf7b Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Sat, 13 Jan 2024 15:15:06 +0000 Subject: [PATCH 4/4] comment was slightly bugging me --- code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm b/code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm index e807a38cedd1..2cca5fe18c0d 100644 --- a/code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm +++ b/code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm @@ -1,2 +1,2 @@ -///from mind/transfer_to. Sent after the mind has been transferred: (mob/previous_body) +///from mind/transfer_to. Sent after the mind has been transferred to a different body: (mob/previous_body) #define COMSIG_MIND_TRANSFERRED "mind_transferred"