Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwatch Signals for QDEL: Less client disconnection? #3477

Merged
merged 3 commits into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/game/machinery/computer/groundside_operations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -306,6 +310,8 @@
..()

if(!isRemoteControlling(user))
if(cam)
user.UnregisterSignal(cam, COMSIG_PARENT_QDELETING)
cam = null
user.reset_view(null)

Expand Down
7 changes: 7 additions & 0 deletions code/modules/cm_marines/overwatch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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)

Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/XenoOverwatch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]."))
Expand Down Expand Up @@ -109,15 +110,22 @@
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
UnregisterSignal(deleted, COMSIG_PARENT_QDELETING)
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
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()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@
SEND_SIGNAL(client, COMSIG_CLIENT_RESET_VIEW, A)
return

/mob/proc/reset_observer_view_on_deletion(atom/deleted, force)
SIGNAL_HANDLER
UnregisterSignal(deleted, COMSIG_PARENT_QDELETING)
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
reset_view(null)

/mob/proc/show_inv(mob/user)
user.set_interaction(src)
Expand Down