diff --git a/code/game/objects/effects/phased_mob.dm b/code/game/objects/effects/phased_mob.dm index b1df969b45c..357e9683072 100644 --- a/code/game/objects/effects/phased_mob.dm +++ b/code/game/objects/effects/phased_mob.dm @@ -23,6 +23,7 @@ jaunter.forceMove(src) if(ismob(jaunter)) var/mob/mob_jaunter = jaunter + RegisterSignal(mob_jaunter, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change)) mob_jaunter.reset_perspective(src) /obj/effect/dummy/phased_mob/Destroy() @@ -55,6 +56,7 @@ /obj/effect/dummy/phased_mob/Exited(atom/movable/gone, direction) . = ..() if(gone == jaunter) + UnregisterSignal(jaunter, COMSIG_MOB_STATCHANGE) SEND_SIGNAL(src, COMSIG_MOB_EJECTED_FROM_JAUNT, jaunter) jaunter = null @@ -98,3 +100,9 @@ newloc = can_z_move(direction, get_turf(src), newloc, ZMOVE_INCAPACITATED_CHECKS | ZMOVE_FEEDBACK | ZMOVE_ALLOW_ANCHORED, user) return newloc + +/// Signal proc for [COMSIG_MOB_STATCHANGE], to throw us out of the jaunt if we lose consciousness. +/obj/effect/dummy/phased_mob/proc/on_stat_change(mob/living/source, new_stat, old_stat) + SIGNAL_HANDLER + if(source == jaunter && source.stat != CONSCIOUS) + eject_jaunter() diff --git a/code/modules/antagonists/heretic/magic/space_crawl.dm b/code/modules/antagonists/heretic/magic/space_crawl.dm index 90f74a37047..49b9ae96f30 100644 --- a/code/modules/antagonists/heretic/magic/space_crawl.dm +++ b/code/modules/antagonists/heretic/magic/space_crawl.dm @@ -83,7 +83,6 @@ jaunter.put_in_hands(right_hand) RegisterSignal(jaunter, SIGNAL_REMOVETRAIT(TRAIT_ALLOW_HERETIC_CASTING), PROC_REF(on_focus_lost)) - RegisterSignal(jaunter, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change)) playsound(our_turf, 'sound/magic/cosmic_energy.ogg', 50, TRUE, -1) our_turf.visible_message(span_warning("[jaunter] sinks into [our_turf]!")) new /obj/effect/temp_visual/space_explosion(our_turf) @@ -107,7 +106,7 @@ /datum/action/cooldown/spell/jaunt/space_crawl/on_jaunt_exited(obj/effect/dummy/phased_mob/jaunt, mob/living/unjaunter) UnregisterSignal(jaunt, COMSIG_MOVABLE_MOVED) - UnregisterSignal(unjaunter, list(SIGNAL_REMOVETRAIT(TRAIT_ALLOW_HERETIC_CASTING), COMSIG_MOB_STATCHANGE)) + UnregisterSignal(unjaunter, list(SIGNAL_REMOVETRAIT(TRAIT_ALLOW_HERETIC_CASTING))) playsound(get_turf(unjaunter), 'sound/magic/cosmic_energy.ogg', 50, TRUE, -1) new /obj/effect/temp_visual/space_explosion(get_turf(unjaunter)) if(iscarbon(unjaunter)) @@ -122,13 +121,6 @@ var/turf/our_turf = get_turf(source) try_exit_jaunt(our_turf, source, TRUE) -/// Signal proc for [COMSIG_MOB_STATCHANGE], to throw us out of the jaunt if we lose consciousness. -/datum/action/cooldown/spell/jaunt/space_crawl/proc/on_stat_change(mob/living/source, new_stat, old_stat) - SIGNAL_HANDLER - if(new_stat != CONSCIOUS) - var/turf/our_turf = get_turf(source) - try_exit_jaunt(our_turf, source, TRUE) - /// Spacecrawl "hands", prevent the user from holding items in spacecrawl /obj/item/space_crawl name = "space crawl"