Skip to content

Commit

Permalink
reset CAS direct camera on change to avoid duplicated signal handlers (
Browse files Browse the repository at this point in the history
…#4755)

# About the pull request

<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

Explicitely resets CAS direct guidance camera before setting a new one,
avoiding log being flooded by double signal registrations

```
runtime error: mob_resist overridden. Use override = TRUE to suppress this warning
proc name: stack trace (/proc/stack_trace)
  source file: code/__HELPERS/unsorted.dm,1893
  usr: Honk (/mob/living/carbon/human)
  src: null
  usr.loc: the floor (206,40,4) (/turf/open/shuttle/dropship)
```
  • Loading branch information
fira authored Oct 26, 2023
1 parent fda83c2 commit 08aef2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions code/game/machinery/computer/dropship_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -594,14 +594,21 @@
return

var/targ_id = text2num(href_list["cas_camera"])

var/datum/cas_signal/new_signal
for(var/datum/cas_signal/LT as anything in cas_group.cas_signals)
if(LT.target_id == targ_id && LT.valid_signal())
selected_cas_signal = LT
new_signal = LT
break

if(!selected_cas_signal)
if(!new_signal)
to_chat(usr, SPAN_WARNING("Target lost or obstructed."))
return

if(usr in selected_cas_signal?.linked_cam?.viewing_users) // Reset previous cam
remove_from_view(usr)

selected_cas_signal = new_signal
if(selected_cas_signal && selected_cas_signal.linked_cam)
selected_cas_signal.linked_cam.view_directly(usr)
else
Expand Down

0 comments on commit 08aef2a

Please sign in to comment.