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..2cca5fe18c0d --- /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 to a different body: (mob/previous_body) +#define COMSIG_MIND_TRANSFERRED "mind_transferred" diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index f3b141c0d9f8..cbc9d2c421dd 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 @@ -726,6 +727,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() @@ -811,6 +813,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 @@ -939,6 +944,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 2c06d28de8bb..22bd9aa0cf61 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -619,7 +619,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"