Skip to content

Commit

Permalink
Fixes monkey orbiting breaking the camera (#5383)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->

# About the pull request

Fixes orbiting a monkey/farwa/stok/etc. locking your camera onto it.

This was happening due to `RegisterSignal(src, COMSIG_MOVABLE_MOVED,
PROC_REF(observer_move_react))` not being called if the target mob
didn't have a HUD, meaning that the client's `eye` wouldn't be set back
to their body when they tried moving away.
I also moved the `COMSIG_PARENT_QDELETING` one over too so that the same
doesn't happen if the target mob is deleted.

(The other signals all seem to be HUD related.)

# Explain why it's good for the game

Bug!

# Testing Photographs and Procedure
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->
<details>
<summary>Screenshots & Videos</summary>

## Before:


https://github.com/cmss13-devs/cmss13/assets/57483089/c188db1f-4fb2-4634-baeb-b87ab6e17ae8


https://github.com/cmss13-devs/cmss13/assets/57483089/05348463-49ed-442c-80c3-9c880b4f3d91

## After:


https://github.com/cmss13-devs/cmss13/assets/57483089/3f0c8da7-d688-4523-8f63-9f743e699326


https://github.com/cmss13-devs/cmss13/assets/57483089/b39eefa3-3138-437b-bffe-89813ee0a46b

</details>


# Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
label your changes in the changelog. Please note that maintainers freely
reserve the right to remove and add tags should they deem it
appropriate. You can attempt to finagle the system all you want, but
it's best to shoot for clear communication right off the bat. -->
<!-- If you add a name after the ':cl', that name will be used in the
changelog. You must add your CKEY after the CL if your GitHub name
doesn't match. Maintainers freely reserve the right to remove and add
tags should they deem it appropriate. -->

:cl:
fix: Fixed observing a monkey/farwa/stok/etc. locking the camera onto
it.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! -->
  • Loading branch information
SabreML committed Jan 6, 2024
1 parent a12c7a2 commit 58e4178
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@
var/mob/living/carbon/human/human_target = target

client.eye = human_target
observe_target_mob = human_target
RegisterSignal(observe_target_mob, COMSIG_PARENT_QDELETING, PROC_REF(clean_observe_target))
RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(observer_move_react))

if(!human_target.hud_used)
return
Expand Down Expand Up @@ -290,19 +293,14 @@

break

observe_target_mob = human_target
RegisterSignal(observe_target_mob, COMSIG_PARENT_QDELETING, PROC_REF(clean_observe_target))
RegisterSignal(observe_target_mob, COMSIG_MOB_GHOSTIZE, PROC_REF(observe_target_ghosting))
RegisterSignal(observe_target_mob, COMSIG_MOB_NEW_MIND, PROC_REF(observe_target_new_mind))
RegisterSignal(observe_target_mob, COMSIG_MOB_LOGIN, PROC_REF(observe_target_login))

RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(observer_move_react))

if(human_target.client)
observe_target_client = human_target.client
RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_ADD, PROC_REF(observe_target_screen_add))
RegisterSignal(observe_target_client, COMSIG_CLIENT_SCREEN_REMOVE, PROC_REF(observe_target_screen_remove))
return

/mob/dead/observer/reset_perspective(atom/A)
if(observe_target_mob)
Expand Down

0 comments on commit 58e4178

Please sign in to comment.