diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 1585bebe530..899f74069a6 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -266,6 +266,12 @@ ///called when the movable is added to a disposal holder object for disposal movement: (obj/structure/disposalholder/holder, obj/machinery/disposal/source) #define COMSIG_MOVABLE_DISPOSING "movable_disposing" + +// /datum/mind signals + +///from base of /datum/mind/proc/transfer_to(mob/living/new_character) +#define COMSIG_MIND_TRANSER_TO "mind_transfer_to" + // /mob signals ///from base of /mob/Login(): () diff --git a/code/datums/mind.dm b/code/datums/mind.dm index b2ac32f8c31..052dc268b72 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -119,6 +119,7 @@ if(active) new_character.key = key //now transfer the key to link the client to our new body + SEND_SIGNAL(src, COMSIG_MIND_TRANSER_TO, new_character) /datum/mind/proc/store_memory(new_text) memory += "[new_text]
" diff --git a/code/datums/soullink.dm b/code/datums/soullink.dm index a48d63191c1..f5727f1d0d0 100644 --- a/code/datums/soullink.dm +++ b/code/datums/soullink.dm @@ -164,52 +164,3 @@ /datum/soullink/multisharer/replacementpool/sharerDies(gibbed, mob/living/sharer) removeSoulsharer(sharer) - -//////////////// -// SOUL HOOK // -//////////////// -// When the owner transitions from dead to alive or vice versa, -// the linked atom is notified - -// Atoms that actually utilize this system are responsible for handling the GC cleanup themselves -// Splashing the GC handling onto every atom would be a big old waste - -/datum/soullink/soulhook - var/atom/movable/otherend - -/datum/soullink/soulhook/Destroy() - if(otherend) - LAZYREMOVE(otherend.sharedSoulhooks, src) - otherend = null - return ..() - -/datum/soullink/soulhook/parseArgs(mob/living/owner, atom/movable/other) - if(!owner || !other) - return FALSE - soulowner = owner - otherend = other - LAZYADD(owner.ownedSoullinks, src) - LAZYADD(other.sharedSoulhooks, src) - return TRUE - -/datum/soullink/soulhook/ownerDies(gibbed, mob/living/owner) - if(otherend) - otherend.onSoullinkDeath(gibbed, owner) - -/datum/soullink/soulhook/ownerRevives(mob/living/owner) - if(otherend) - otherend.onSoullinkRevive(owner) - -// oops I'm butchering the application of this -/datum/soullink/soulhook/removeSoulsharer(atom/movable/other) - if(otherend == other) - otherend = null - LAZYREMOVE(other.sharedSoulhooks, src) - qdel(src) // not much point in a soul link with one end out of the picture for good - -/atom/movable - var/list/sharedSoulhooks = null - -/atom/movable/proc/onSoullinkDeath(gibbed, mob/living/owner) - -/atom/movable/proc/onSoullinkRevive(mob/living/owner) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index f630fe4e743..aad316726ac 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -100,10 +100,9 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ /obj/machinery/clonepod/Destroy() if(connected) connected.pods -= src - for(var/s in sharedSoulhooks) - var/datum/soullink/S = s - S.removeSoulsharer(src) //If a sharer is destroy()'d, they are simply removed - sharedSoulhooks = null + if(clonemind) + UnregisterSignal(clonemind.current, COMSIG_LIVING_REVIVE) + UnregisterSignal(clonemind, COMSIG_MIND_TRANSER_TO) QDEL_NULL(Radio) QDEL_NULL(countdown) QDEL_LIST(missing_organs) @@ -306,7 +305,8 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ else if(grab_ghost_when == CLONER_MATURE_CLONE) to_chat(clonemind.current, "Your body is beginning to regenerate in a cloning pod. You will become conscious when it is complete.") // Set up a soul link with the dead body to catch a revival - soullink(/datum/soullink/soulhook, clonemind.current, src) + RegisterSignal(clonemind.current, COMSIG_LIVING_REVIVE, .proc/occupant_got_revived) + RegisterSignal(clonemind, COMSIG_MIND_TRANSER_TO, .proc/occupant_got_revived) update_icon() @@ -494,6 +494,8 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ return if(grab_ghost_when == CLONER_MATURE_CLONE) + UnregisterSignal(clonemind.current, COMSIG_LIVING_REVIVE) + UnregisterSignal(clonemind, COMSIG_MIND_TRANSER_TO) clonemind.transfer_to(occupant) occupant.grab_ghost() update_clone_antag(occupant) @@ -501,10 +503,7 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ to_chat(occupant, "There is a bright flash!
\ You feel like a new being.
") occupant.flash_eyes(visual = 1) - for(var/s in sharedSoulhooks) - var/datum/soullink/S = s - S.removeSoulsharer(src) //If a sharer is destroy()'d, they are simply removed - sharedSoulhooks = null + clonemind = null for(var/i in missing_organs) @@ -525,10 +524,8 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ if(occupant) connected_message("Critical Error!") announce_radio_message("Critical error! Please contact a Thinktronic Systems technician, as your warranty may be affected.") - for(var/s in sharedSoulhooks) - var/datum/soullink/S = s - S.removeSoulsharer(src) //If a sharer is destroy()'d, they are simply removed - sharedSoulhooks = null + UnregisterSignal(clonemind.current, COMSIG_LIVING_REVIVE) + UnregisterSignal(clonemind, COMSIG_MIND_TRANSER_TO) if(!go_easy) if(occupant.mind != clonemind) clonemind.transfer_to(occupant) @@ -541,6 +538,7 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ for(var/i in missing_organs) qdel(i) missing_organs.Cut() + clonemind = null spawn(40) qdel(occupant) @@ -586,10 +584,9 @@ GLOBAL_LIST_INIT(cloner_biomass_items, list(\ go_out() ..() -/obj/machinery/clonepod/onSoullinkRevive(mob/living/L) - if(occupant && L == clonemind.current) - // The old body's back in shape, time to ditch the cloning one - malfunction(go_easy = TRUE) +/obj/machinery/clonepod/proc/occupant_got_revived() + // The old body's back in shape, time to ditch the cloning one + malfunction(go_easy = TRUE) /obj/machinery/clonepod/proc/maim_clone(mob/living/carbon/human/H) LAZYINITLIST(missing_organs) diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index ce5d41f1eba..48fe9d996a9 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -304,11 +304,11 @@ if(!player) return - ckey = player.ckey - if(player.mob && player.mob.mind) player.mob.mind.transfer_to(src) player.mob.mind.assigned_role = "Drone" + else + ckey = player.ckey lawupdate = 0 to_chat(src, "Systems rebooted. Loading base pattern maintenance protocol... loaded.") diff --git a/code/modules/mob/living/stat_states.dm b/code/modules/mob/living/stat_states.dm index e1b8a6e432e..fb54bcff2a5 100644 --- a/code/modules/mob/living/stat_states.dm +++ b/code/modules/mob/living/stat_states.dm @@ -62,6 +62,7 @@ update_sight() updatehealth("update revive") + SEND_SIGNAL(src, COMSIG_LIVING_REVIVE, updating) for(var/s in ownedSoullinks) var/datum/soullink/S = s S.ownerRevives(src)