Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes TGUI transfer over when changing bodies #5388

Merged
merged 5 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/signals_mind.dm
Original file line number Diff line number Diff line change
@@ -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"
10 changes: 10 additions & 0 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down