Remove soulhook. Fix cloning with mind transfer. Fix drone join (#15002)

This commit is contained in:
Farie82
2020-12-16 21:13:13 +01:00
committed by GitHub
parent 1843266a4a
commit e66c91c7c4
6 changed files with 24 additions and 68 deletions
+6
View File
@@ -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(): ()
+1
View File
@@ -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]<BR>"
-49
View File
@@ -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)
+14 -17
View File
@@ -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, "<span class='notice'>Your body is beginning to regenerate in a cloning pod. You will become conscious when it is complete.</span>")
// 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, "<span class='notice'><b>There is a bright flash!</b><br>\
<i>You feel like a new being.</i></span>")
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)
@@ -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, "<b>Systems rebooted</b>. Loading base pattern maintenance protocol... <b>loaded</b>.")
+1
View File
@@ -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)