Fix Zoomed Item Qdel Loop (#19523)

* lets refactor that

* unzoom fix

* taur fix
This commit is contained in:
Will
2026-06-14 02:04:58 -04:00
committed by GitHub
parent 54a68ffffc
commit d96a2fea1c
7 changed files with 42 additions and 38 deletions
+5 -5
View File
@@ -62,13 +62,10 @@
/**
* If an item is coordinating this view (scopes/binoculars)
* Handles remote views that are managed by a held item. The held item must remain in the mob's
* inventory, and will call zoom() and unzoom() when it starts and ends. Optionally showing a message.
* inventory, and will call unzoom() when it ends. Optionally showing a message.
*/
if(isitem(managing_item))
host_item = managing_item
// Unfortunately too many things read this to control item state for me to remove this.
// Oh well! better than GetComponent() everywhere. Lets just manage item/zoom in this component though...
host_item.zoom = TRUE
// Feedback
show_message = show_visible_messages
if(show_message)
@@ -96,7 +93,7 @@
/datum/component/remote_view/Destroy(force)
// Clear item
if(host_item)
host_item.zoom(host_mob)
host_item.unzoom(host_mob)
// Feedback
if(show_message)
host_mob.visible_message(span_filter_notice("[host_item.zoomdevicename ? "[host_mob] looks up from the [host_item.name]" : "[host_mob] lowers the [host_item.name]"]."))
@@ -246,6 +243,9 @@
SIGNAL_HANDLER
SHOULD_NOT_OVERRIDE(TRUE)
PRIVATE_PROC(TRUE)
// Don't forward movement to ourselves if we're using a spyglass or something
if(host_mob == remote_view_target)
return
// I'd move this into the config datum if it didn't require the component to also be passed too. Lets avoid GetComponent on a hotpath.
return settings.handle_relay_movement(src, host_mob, direction)