From c43e4fb5f78e2983b01be75ddc830e3822a47715 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 18 Jan 2021 23:31:35 +0100 Subject: [PATCH] [MIRROR] Laughter demons now eject spontaneous revivals (#2776) * Laughter demons now eject spontaneous revivals (#56095) Very occasionally, a laughter demon will eat a changeling, or someone with very strong nanites, and then are rendered helpless as someone punches their way out. Instead, now they will be confusingly ejected from the laughter demon's internal hammerspace pocket, where they can than then attempt to make their escape. * Laughter demons now eject spontaneous revivals Co-authored-by: coiax --- .../antagonists/slaughter/slaughter.dm | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/code/modules/antagonists/slaughter/slaughter.dm b/code/modules/antagonists/slaughter/slaughter.dm index 9bb970cf53b..d76c7987b94 100644 --- a/code/modules/antagonists/slaughter/slaughter.dm +++ b/code/modules/antagonists/slaughter/slaughter.dm @@ -259,6 +259,9 @@ if(!M) continue + // Unregister the signal first, otherwise it'll trigger the "ling revived inside us" code + UnregisterSignal(M, COMSIG_MOB_STATCHANGE) + M.forceMove(T) if(M.revive(full_heal = TRUE, admin_revive = TRUE)) M.grab_ghost(force = TRUE) @@ -266,14 +269,27 @@ to_chat(M, "You leave [src]'s warm embrace, and feel ready to take on the world.") /mob/living/simple_animal/hostile/imp/slaughter/laughter/bloodcrawl_swallow(mob/living/victim) - if(consumed_mobs) - // Keep their corpse so rescue is possible - consumed_mobs += victim - else - // Be safe and just eject the corpse - victim.forceMove(get_turf(victim)) - victim.exit_blood_effect() - victim.visible_message("[victim] falls out of the air, covered in blood, looking highly confused. And dead.") + // Keep their corpse so rescue is possible + consumed_mobs += victim + RegisterSignal(victim, COMSIG_MOB_STATCHANGE, .proc/on_victim_statchange) + +/* Handle signal from a consumed mob changing stat. + * + * A signal handler for if one of the laughter demon's consumed mobs has + * changed stat. If they're no longer dead (because they were dead when + * swallowed), eject them so they can't rip their way out from the inside. + */ +/mob/living/simple_animal/hostile/imp/slaughter/laughter/proc/on_victim_statchange(mob/living/victim, new_stat) + SIGNAL_HANDLER + + if(new_stat == DEAD) + return + // Someone we've eaten has spontaneously revived; maybe nanites, maybe a changeling + victim.forceMove(get_turf(src)) + victim.exit_blood_effect() + victim.visible_message("[victim] falls out of the air, covered in blood, with a confused look on their face.") + consumed_mobs -= victim + UnregisterSignal(victim, COMSIG_MOB_STATCHANGE) /mob/living/simple_animal/hostile/imp/slaughter/engine_demon name = "engine demon"