diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 234852539226..6cefa28a2c95 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -273,13 +273,17 @@ to_chat(usr, "[icon2html(src, usr)] [SPAN_WARNING("Searching for helmet cam. No helmet cam found for this marine! Tell your squad to put their helmets on!")]") else if(cam && cam == new_cam)//click the camera you're watching a second time to stop watching. visible_message("[icon2html(src, viewers(src))] [SPAN_BOLDNOTICE("Stopping helmet cam view of [cam_target].")]") + usr.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) cam = null usr.reset_view(null) else if(usr.client.view != world_view_size) to_chat(usr, SPAN_WARNING("You're too busy peering through binoculars.")) else + if(cam) + usr.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) cam = new_cam usr.reset_view(cam) + usr.RegisterSignal(cam, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/mob, reset_observer_view_on_deletion)) if("activate_echo") var/reason = input(usr, "What is the purpose of Echo Squad?", "Activation Reason") @@ -306,6 +310,8 @@ ..() if(!isRemoteControlling(user)) + if(cam) + user.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) cam = null user.reset_view(null) diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm index 0c303b7028e3..401d8fd9784a 100644 --- a/code/modules/cm_marines/overwatch.dm +++ b/code/modules/cm_marines/overwatch.dm @@ -430,6 +430,7 @@ current_squad = null if(cam && !ishighersilicon(usr)) usr.reset_view(null) + usr.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) cam = null state = 0 if("pick_squad") @@ -593,13 +594,17 @@ to_chat(usr, "[icon2html(src, usr)] [SPAN_WARNING("Searching for helmet cam. No helmet cam found for this marine! Tell your squad to put their helmets on!")]") else if(cam && cam == new_cam)//click the camera you're watching a second time to stop watching. visible_message("[icon2html(src, viewers(src))] [SPAN_BOLDNOTICE("Stopping helmet cam view of [cam_target].")]") + usr.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) cam = null usr.reset_view(null) else if(usr.client.view != world_view_size) to_chat(usr, SPAN_WARNING("You're too busy peering through binoculars.")) else + if(cam) + usr.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) cam = new_cam usr.reset_view(cam) + usr.RegisterSignal(cam, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/mob, reset_observer_view_on_deletion)) attack_hand(usr) //The above doesn't ever seem to work. /obj/structure/machinery/computer/overwatch/check_eye(mob/user) @@ -611,6 +616,8 @@ /obj/structure/machinery/computer/overwatch/on_unset_interaction(mob/user) ..() if(!isRemoteControlling(user)) + if(cam) + user.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) cam = null user.reset_view(null) diff --git a/code/modules/mob/living/carbon/xenomorph/XenoOverwatch.dm b/code/modules/mob/living/carbon/xenomorph/XenoOverwatch.dm index a92098462524..fdb19429c0f7 100644 --- a/code/modules/mob/living/carbon/xenomorph/XenoOverwatch.dm +++ b/code/modules/mob/living/carbon/xenomorph/XenoOverwatch.dm @@ -71,6 +71,7 @@ SEND_SIGNAL(src, COMSIG_XENO_STOP_OVERWATCH, oldXeno) UnregisterSignal(src, COMSIG_MOB_MOVE_OR_LOOK) + UnregisterSignal(oldXeno, COMSIG_PARENT_QDELETING) if(oldXeno) to_chat(src, SPAN_XENOWARNING("You stop watching [oldXeno].")) @@ -109,15 +110,21 @@ SEND_SIGNAL(src, COMSIG_XENO_STOP_OVERWATCH_XENO, oldXeno) oldXeno.hud_set_queen_overwatch() UnregisterSignal(src, COMSIG_MOB_MOVE_OR_LOOK) + UnregisterSignal(oldXeno, COMSIG_PARENT_QDELETING) observed_xeno = targetXeno observed_xeno.hud_set_queen_overwatch() SEND_SIGNAL(src, COMSIG_XENO_OVERWATCH_XENO, observed_xeno) RegisterSignal(src, COMSIG_MOB_MOVE_OR_LOOK, PROC_REF(overwatch_handle_mob_move_or_look)) + RegisterSignal(observed_xeno, COMSIG_PARENT_QDELETING, PROC_REF(overwatch_handle_deletion)) src.reset_view() +/mob/living/carbon/xenomorph/proc/overwatch_handle_deletion(mob/living/carbon/xenomorph/deleted, forced) + SIGNAL_HANDLER + overwatch(deleted, TRUE) + // Called from xeno Life() // Makes sure that Xeno overwatch is reset when the overwatched Xeno dies. /mob/living/carbon/xenomorph/proc/handle_overwatch() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 7e7952974c8c..652d11b2a70b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -356,6 +356,9 @@ SEND_SIGNAL(client, COMSIG_CLIENT_RESET_VIEW, A) return +/mob/proc/reset_observer_view_on_deletion(atom/deleted, force) + SIGNAL_HANDLER + reset_view(null) /mob/proc/show_inv(mob/user) user.set_interaction(src)