Reviving while a clone is "baking" causes the clone to fail

This commit is contained in:
Crazylemon64
2017-06-04 04:14:16 -07:00
parent e3b6f79920
commit ebadfa8276
5 changed files with 98 additions and 13 deletions
+57
View File
@@ -59,6 +59,13 @@
//Override this for content
/datum/soullink/proc/sharerDies(gibbed, mob/living/owner)
//Runs after /living update_revive()
//Override this for content
/datum/soullink/proc/ownerRevives(mob/living/owner)
//Runs after /living update_revive()
//Override this for content
/datum/soullink/proc/sharerRevives(mob/living/owner)
//Quick-use helper
/proc/soullink(typepath, ...)
@@ -155,3 +162,53 @@
//Lose your claim to the throne!
/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)
+30 -9
View File
@@ -87,6 +87,10 @@
/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
QDEL_NULL(Radio)
QDEL_NULL(countdown)
QDEL_LIST(missing_organs)
@@ -288,6 +292,8 @@
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)
update_icon()
@@ -467,7 +473,12 @@
update_clone_antag(occupant)
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)
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
for(var/i in missing_organs)
qdel(i)
@@ -479,17 +490,22 @@
occupant = null
update_icon()
/obj/machinery/clonepod/proc/malfunction()
/obj/machinery/clonepod/proc/malfunction(go_easy = FALSE)
if(occupant)
connected_message("Critical Error!")
announce_radio_message("Critical error! Please contact a Thinktronic Systems technician, as your warranty may be affected.")
if(occupant.mind != clonemind)
clonemind.transfer_to(occupant)
occupant.grab_ghost() // We really just want to make you suffer.
to_chat(occupant, {"<span class='warning'><b>Agony blazes across your
consciousness as your body is torn apart.</b><br>
<i>Is this what dying is like? Yes it is.</i></span>"})
occupant << sound('sound/hallucinations/veryfar_noise.ogg',0,1,50)
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(!go_easy)
if(occupant.mind != clonemind)
clonemind.transfer_to(occupant)
occupant.grab_ghost() // We really just want to make you suffer.
to_chat(occupant, {"<span class='warning'><b>Agony blazes across your
consciousness as your body is torn apart.</b><br>
<i>Is this what dying is like? Yes it is.</i></span>"})
occupant << sound('sound/hallucinations/veryfar_noise.ogg',0,1,50)
for(var/i in missing_organs)
qdel(i)
missing_organs.Cut()
@@ -542,6 +558,11 @@
else
return
/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/maim_clone(mob/living/carbon/human/H)
LAZYINITLIST(missing_organs)
for(var/i in missing_organs)
+2 -2
View File
@@ -6,9 +6,9 @@
for(var/s in ownedSoullinks)
var/datum/soullink/S = s
S.ownerDies(gibbed)
S.ownerDies(gibbed, src)
for(var/s in sharedSoullinks)
var/datum/soullink/S = s
S.sharerDies(gibbed)
S.sharerDies(gibbed, src)
..(gibbed)
+7
View File
@@ -49,4 +49,11 @@
update_canmove()
// update_blind_effects()
updatehealth()
for(var/s in ownedSoullinks)
var/datum/soullink/S = s
S.ownerRevives(src)
for(var/s in sharedSoullinks)
var/datum/soullink/S = s
S.sharerRevives(src)
return 1
+2 -2
View File
@@ -218,7 +218,7 @@
#include "code\datums\recipe.dm"
#include "code\datums\ruins.dm"
#include "code\datums\shuttles.dm"
#include "code\datums\soullink.dm
#include "code\datums\soullink.dm"
#include "code\datums\spell.dm"
#include "code\datums\statclick.dm"
#include "code\datums\supplypacks.dm"
@@ -322,7 +322,7 @@
#include "code\datums\spells\touch_attacks.dm"
#include "code\datums\spells\trigger.dm"
#include "code\datums\spells\turf_teleport.dm"
#include "code\datums\spells\wizard.dm""
#include "code\datums\spells\wizard.dm"
#include "code\datums\vr\level.dm"
#include "code\datums\weather\weather.dm"
#include "code\datums\weather\weather_types.dm"