[MIRROR] Remote view recursive prey fix (#11853)

Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-10-21 22:55:14 -07:00
committed by GitHub
parent 837ea9590d
commit 135c7835f2
5 changed files with 29 additions and 5 deletions

View File

@@ -27,7 +27,7 @@
RegisterSignal(host_mob, COMSIG_MOB_RESET_PERSPECTIVE, PROC_REF(on_reset_perspective))
RegisterSignal(host_mob, COMSIG_MOB_LOGOUT, PROC_REF(handle_endview))
RegisterSignal(host_mob, COMSIG_MOB_DEATH, PROC_REF(handle_endview))
RegisterSignal(host_mob, COMSIG_REMOTE_VIEW_CLEAR, PROC_REF(handle_endview))
RegisterSignal(host_mob, COMSIG_REMOTE_VIEW_CLEAR, PROC_REF(handle_forced_endview))
// Recursive move component fires this, we only want it to handle stuff like being inside a paicard when releasing turf lock
if(isturf(focused_on))
RegisterSignal(host_mob, COMSIG_OBSERVER_MOVED, PROC_REF(handle_recursive_moved))
@@ -36,7 +36,7 @@
if(host_mob != remote_view_target) // Some items just offset our view, so we set ourselves as the view target, don't double dip if so!
RegisterSignal(remote_view_target, COMSIG_QDELETING, PROC_REF(handle_endview))
RegisterSignal(remote_view_target, COMSIG_MOB_RESET_PERSPECTIVE, PROC_REF(on_remotetarget_reset_perspective))
RegisterSignal(remote_view_target, COMSIG_REMOTE_VIEW_CLEAR, PROC_REF(handle_endview))
RegisterSignal(remote_view_target, COMSIG_REMOTE_VIEW_CLEAR, PROC_REF(handle_forced_endview))
/datum/component/remote_view/Destroy(force)
. = ..()
@@ -77,8 +77,15 @@
end_view()
qdel(src)
/// By default pass this down, but we need unique handling for subtypes sometimes
/datum/component/remote_view/proc/handle_forced_endview(datum/source)
SIGNAL_HANDLER
PROTECTED_PROC(TRUE)
handle_endview(source)
/datum/component/remote_view/proc/handle_endview(datum/source)
SIGNAL_HANDLER
SHOULD_NOT_OVERRIDE(TRUE)
PRIVATE_PROC(TRUE)
if(!host_mob)
return
@@ -151,7 +158,7 @@
RegisterSignal(host_item, COMSIG_QDELETING, PROC_REF(handle_endview))
RegisterSignal(host_item, COMSIG_MOVABLE_MOVED, PROC_REF(handle_endview))
RegisterSignal(host_item, COMSIG_ITEM_DROPPED, PROC_REF(handle_endview))
RegisterSignal(host_item, COMSIG_REMOTE_VIEW_CLEAR, PROC_REF(handle_endview))
RegisterSignal(host_item, COMSIG_REMOTE_VIEW_CLEAR, PROC_REF(handle_forced_endview))
// If the user has already limited their HUD this avoids them having a HUD when they zoom in
if(host_mob.hud_used.hud_shown)
host_mob.toggle_zoom_hud()
@@ -257,7 +264,7 @@
view_coordinator = coordinator
view_coordinator.look(host_mob)
LAZYDISTINCTADD(viewers, WEAKREF(host_mob))
RegisterSignal(view_coordinator, COMSIG_REMOTE_VIEW_CLEAR, PROC_REF(handle_endview))
RegisterSignal(view_coordinator, COMSIG_REMOTE_VIEW_CLEAR, PROC_REF(handle_forced_endview))
// If you get this crash, it's because check_eye() in look() failed
if(!parent)
CRASH("Remoteview failed, look() cancelled view during component Initilize. Usually this is caused by check_eye().")
@@ -353,6 +360,20 @@
cache_mob.client.perspective = EYE_PERSPECTIVE // --this is required too.
if(!isturf(cache_mob.loc)) // For stuff like paicards
cache_mob.AddComponent(/datum/component/recursive_move) // Will rebuild parent chain.
// Because nested vore bellies do NOT get handled correctly for recursive prey. We need to tell the belly's occupants to decouple too... Then their own belly's occupants...
// Yes, two loops is faster. Because we skip typechecking byondcode side and instead do it engine side when getting the contents of the mob,
// we also skip typechecking every /obj in the mob on the byondcode side... Evil wizard knowledge.
for(var/obj/belly/check_belly in cache_mob.contents)
SEND_SIGNAL(check_belly, COMSIG_REMOTE_VIEW_CLEAR)
for(var/obj/item/dogborg/sleeper/check_sleeper in cache_mob.contents)
SEND_SIGNAL(check_sleeper, COMSIG_REMOTE_VIEW_CLEAR)
qdel(src)
/// We were forcibly disconnected, this situation is probably a recursive hellscape, so just decouple entirely and fix it when someone moves.
/datum/component/remote_view/mob_holding_item/handle_forced_endview(atom/source)
if(!host_mob)
return
needs_to_decouple = TRUE
decouple_view_to_turf( host_mob, get_turf(host_mob))
#undef MAX_RECURSIVE

View File

@@ -197,6 +197,7 @@
anchored = TRUE
unacidable = TRUE
dir = WEST
flags = REMOTEVIEW_ON_ENTER
var/base_icon_state = "cryopod_0" //VOREStation Edit - New Icon
var/occupied_icon_state = "cryopod_1" //VOREStation Edit - New Icon

View File

@@ -4,7 +4,6 @@
desc = "A standard recharger for all devices that use power."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "recharger0"
flags = REMOTEVIEW_ON_ENTER
anchored = TRUE
use_power = USE_POWER_IDLE
idle_power_usage = 4

View File

@@ -6,6 +6,7 @@
density = TRUE
anchored = TRUE
unacidable = TRUE
flags = REMOTEVIEW_ON_ENTER
circuit = /obj/item/circuitboard/recharge_station
use_power = USE_POWER_IDLE
idle_power_usage = 50

View File

@@ -887,6 +887,8 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
return FALSE
if(isturf(client.mob.loc) && get_turf(client.eye) == get_turf(client.mob))
return FALSE
if(ismecha(client.mob.loc) && client.eye == client.mob.loc)
return FALSE
return (client.eye != client.mob)
#undef ADMINSWARNED_AT