[MIRROR] fix some remote view component desyncs and crashes (#11814)

Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-10-14 13:12:34 -07:00
committed by GitHub
parent b47246cc56
commit 9e39f50248
18 changed files with 65 additions and 15 deletions

View File

@@ -35,6 +35,8 @@ GLOBAL_VAR_INIT(refid_filter, TYPEID(filter(type="angular_blur")))
#define isstructure(A) istype(A, /obj/structure) #define isstructure(A) istype(A, /obj/structure)
#define isdisposalpacket(A) istype(A,/obj/structure/disposalholder)
//--------------- //---------------
//#define isarea(D) istype(D, /area) //Built in //#define isarea(D) istype(D, /area) //Built in

View File

@@ -191,8 +191,9 @@
host_mob.toggle_zoom_hud() host_mob.toggle_zoom_hud()
host_item.zoom = FALSE host_item.zoom = FALSE
// return view offset // return view offset
host_mob.client.pixel_x = 0 if(host_mob.client)
host_mob.client.pixel_y = 0 host_mob.client.pixel_x = 0
host_mob.client.pixel_y = 0
host_mob.handle_vision() host_mob.handle_vision()
// decouple // decouple
UnregisterSignal(host_item, COMSIG_QDELETING) UnregisterSignal(host_item, COMSIG_QDELETING)
@@ -257,6 +258,9 @@
view_coordinator.look(host_mob) view_coordinator.look(host_mob)
LAZYDISTINCTADD(viewers, WEAKREF(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_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().")
/datum/component/remote_view/viewer_managed/Destroy(force) /datum/component/remote_view/viewer_managed/Destroy(force)
UnregisterSignal(view_coordinator, COMSIG_REMOTE_VIEW_CLEAR) UnregisterSignal(view_coordinator, COMSIG_REMOTE_VIEW_CLEAR)
@@ -298,6 +302,8 @@
if(!host_mob) if(!host_mob)
return return
if(isturf(host_mob.loc)) if(isturf(host_mob.loc))
if(oldloc == remote_view_target)
needs_to_decouple = TRUE
decouple_view_to_turf( host_mob, host_mob.loc) decouple_view_to_turf( host_mob, host_mob.loc)
return return

View File

@@ -753,6 +753,9 @@
return return
if(QDELETED(src)) if(QDELETED(src))
return return
if(ismob(src)) // incase there was a client inside an object being yoinked
var/mob/M = src
M.reset_perspective(src) // Force reset to self before teleport
forceMove(get_turf(usr)) forceMove(get_turf(usr))
if(href_list[VV_HK_EDIT_PARTICLES] && check_rights(R_VAREDIT)) if(href_list[VV_HK_EDIT_PARTICLES] && check_rights(R_VAREDIT))

View File

@@ -132,7 +132,10 @@
/obj/item/material/kitchen/utensil/container_resist(mob/living/M) /obj/item/material/kitchen/utensil/container_resist(mob/living/M)
if(food_inserted_micros) if(food_inserted_micros)
food_inserted_micros -= M food_inserted_micros -= M
M.forceMove(get_turf(src)) if(isdisposalpacket(loc))
M.forceMove(loc)
else
M.forceMove(get_turf(src))
to_chat(M, span_warning("You climb off of \the [src].")) to_chat(M, span_warning("You climb off of \the [src]."))
/obj/item/material/kitchen/utensil/fork /obj/item/material/kitchen/utensil/fork

View File

@@ -51,7 +51,10 @@
/obj/item/mail/container_resist(mob/living/M) /obj/item/mail/container_resist(mob/living/M)
if(istype(M, /mob/living/voice)) return if(istype(M, /mob/living/voice)) return
M.forceMove(get_turf(src)) if(isdisposalpacket(loc))
M.forceMove(loc)
else
M.forceMove(get_turf(src))
to_chat(M, span_warning("You climb out of \the [src].")) to_chat(M, span_warning("You climb out of \the [src]."))
/obj/item/mail/envelope /obj/item/mail/envelope

View File

@@ -399,7 +399,10 @@
return return
/obj/item/bikehorn/rubberducky/pink/container_resist(var/mob/living/escapee) /obj/item/bikehorn/rubberducky/pink/container_resist(var/mob/living/escapee)
escapee.forceMove(get_turf(src)) if(isdisposalpacket(loc))
escapee.forceMove(loc)
else
escapee.forceMove(get_turf(src))
to_chat(escapee, span_vnotice("You managed to crawl out of the rubber ducky!")) to_chat(escapee, span_vnotice("You managed to crawl out of the rubber ducky!"))
/obj/item/bikehorn/rubberducky/grey /obj/item/bikehorn/rubberducky/grey

View File

@@ -26,6 +26,7 @@
return return
usr.on_mob_jump() usr.on_mob_jump()
usr.reset_perspective(usr)
usr.forceMove(pick(get_area_turfs(A))) usr.forceMove(pick(get_area_turfs(A)))
log_admin("[key_name(usr)] jumped to [A]") log_admin("[key_name(usr)] jumped to [A]")
message_admins("[key_name_admin(usr)] jumped to [A]", 1) message_admins("[key_name_admin(usr)] jumped to [A]", 1)
@@ -40,6 +41,7 @@
log_admin("[key_name(usr)] jumped to [T.x],[T.y],[T.z] in [T.loc]") log_admin("[key_name(usr)] jumped to [T.x],[T.y],[T.z] in [T.loc]")
message_admins("[key_name_admin(usr)] jumped to [T.x],[T.y],[T.z] in [T.loc]", 1) message_admins("[key_name_admin(usr)] jumped to [T.x],[T.y],[T.z] in [T.loc]", 1)
usr.on_mob_jump() usr.on_mob_jump()
usr.reset_perspective(usr)
usr.forceMove(T) usr.forceMove(T)
feedback_add_details("admin_verb","JT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","JT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else else
@@ -72,6 +74,7 @@
var/turf/T = get_turf(M) var/turf/T = get_turf(M)
if(isturf(T)) if(isturf(T))
A.on_mob_jump() A.on_mob_jump()
A.reset_perspective(A)
A.forceMove(T) A.forceMove(T)
log_admin("[key_name(usr)] jumped to [key_name(M)]") log_admin("[key_name(usr)] jumped to [key_name(M)]")
message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1) message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1)
@@ -94,6 +97,7 @@
if(!T) if(!T)
to_chat(usr, span_warning("Those coordinates are outside the boundaries of the map.")) to_chat(usr, span_warning("Those coordinates are outside the boundaries of the map."))
return return
A.reset_perspective(A)
A.forceMove(T) A.forceMove(T)
feedback_add_details("admin_verb","JC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","JC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
message_admins("[key_name_admin(usr)] jumped to coordinates [tx], [ty], [tz]") message_admins("[key_name_admin(usr)] jumped to coordinates [tx], [ty], [tz]")
@@ -119,6 +123,7 @@
log_admin("[key_name(usr)] jumped to [key_name(M)]") log_admin("[key_name(usr)] jumped to [key_name(M)]")
message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1) message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1)
usr.on_mob_jump() usr.on_mob_jump()
usr.reset_perspective(usr)
usr.forceMove(get_turf(M)) usr.forceMove(get_turf(M))
feedback_add_details("admin_verb","JK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","JK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else else
@@ -142,6 +147,7 @@
message_admins(msg) message_admins(msg)
admin_ticket_log(M, msg) admin_ticket_log(M, msg)
M.on_mob_jump() M.on_mob_jump()
M.reset_perspective(M)
M.forceMove(get_turf(usr)) M.forceMove(get_turf(usr))
feedback_add_details("admin_verb","GM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","GM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else else
@@ -172,6 +178,7 @@
admin_ticket_log(M, msg) admin_ticket_log(M, msg)
if(M) if(M)
M.on_mob_jump() M.on_mob_jump()
M.reset_perspective(M) // Force reset to self before teleport
M.forceMove(get_turf(usr)) M.forceMove(get_turf(usr))
feedback_add_details("admin_verb","GK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","GK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else else
@@ -191,6 +198,7 @@
if(!M) if(!M)
return return
M.on_mob_jump() M.on_mob_jump()
M.reset_perspective(M) // Force reset to self before teleport
M.forceMove(pick(get_area_turfs(A))) M.forceMove(pick(get_area_turfs(A)))
feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
@@ -225,6 +233,7 @@
if(ismob(AM)) if(ismob(AM))
var/mob/M = AM var/mob/M = AM
M.on_mob_jump() M.on_mob_jump()
M.reset_perspective(M) // Force reset to self before teleport
AM.forceMove(T) AM.forceMove(T)
feedback_add_details("admin_verb", "MA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb", "MA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
message_admins("[key_name_admin(usr)] jumped [AM] to coordinates [tx], [ty], [tz]") message_admins("[key_name_admin(usr)] jumped [AM] to coordinates [tx], [ty], [tz]")

View File

@@ -186,7 +186,10 @@
/obj/item/material/fishing_net/butterfly_net/container_resist(mob/living/M) /obj/item/material/fishing_net/butterfly_net/container_resist(mob/living/M)
if(prob(20)) if(prob(20))
M.forceMove(get_turf(src)) if(isdisposalpacket(loc))
M.forceMove(loc)
else
M.forceMove(get_turf(src))
to_chat(M, span_warning("You climb out of \the [src].")) to_chat(M, span_warning("You climb out of \the [src]."))
update_icon() update_icon()
update_weight() update_weight()

View File

@@ -63,7 +63,10 @@
if(istype(M, /mob/living/voice)) return // CHOMPAdd - Stops sentient food from astral projecting if(istype(M, /mob/living/voice)) return // CHOMPAdd - Stops sentient food from astral projecting
if(food_inserted_micros) if(food_inserted_micros)
food_inserted_micros -= M food_inserted_micros -= M
M.forceMove(get_turf(src)) if(isdisposalpacket(loc))
M.forceMove(loc)
else
M.forceMove(get_turf(src))
to_chat(M, span_warning("You climb out of \the [src].")) to_chat(M, span_warning("You climb out of \the [src]."))
#undef CELLS #undef CELLS

View File

@@ -157,7 +157,7 @@ var/list/slot_equipment_priority = list( \
/mob/proc/drop_from_inventory(var/obj/item/W, var/atom/target) /mob/proc/drop_from_inventory(var/obj/item/W, var/atom/target)
if(!W) if(!W)
return FALSE return FALSE
if(isnull(target) && istype( src.loc,/obj/structure/disposalholder)) if(isnull(target) && isdisposalpacket(src.loc))
return remove_from_mob(W, src.loc) return remove_from_mob(W, src.loc)
return remove_from_mob(W, target) return remove_from_mob(W, target)

View File

@@ -1554,7 +1554,7 @@
/mob/living/carbon/human/drop_from_inventory(var/obj/item/W, var/atom/target = null) /mob/living/carbon/human/drop_from_inventory(var/obj/item/W, var/atom/target = null)
if(W in organs) if(W in organs)
return FALSE return FALSE
if(isnull(target) && istype( src.loc,/obj/structure/disposalholder)) if(isnull(target) && isdisposalpacket(src.loc))
return remove_from_mob(W, src.loc) return remove_from_mob(W, src.loc)
return ..() return ..()

View File

@@ -426,7 +426,7 @@
src.forceMove(card) src.forceMove(card)
card.forceMove(B) card.forceMove(B)
if(istype(loc,/obj/structure/disposalholder)) if(isdisposalpacket(loc))
var/obj/structure/disposalholder/hold = loc var/obj/structure/disposalholder/hold = loc
src.forceMove(card) src.forceMove(card)
card.forceMove(hold) card.forceMove(hold)

View File

@@ -1315,6 +1315,7 @@
return return
L.stop_pulling() L.stop_pulling()
L.Weaken(3) L.Weaken(3)
L.reset_perspective() // Needed for food items that get gobbled with micros in them
GLOB.prey_eaten_roundstat++ GLOB.prey_eaten_roundstat++
if(target.reciever) //We don't have to worry if(target.reciever) //We don't have to worry
AM.unbuckle_all_mobs(TRUE) AM.unbuckle_all_mobs(TRUE)

View File

@@ -254,6 +254,8 @@
SHOULD_CALL_PARENT(TRUE) SHOULD_CALL_PARENT(TRUE)
if(!client) if(!client)
return return
if(!isnull(new_eye) && QDELETED(new_eye))
new_eye = src // Something has gone terribly wrong
if(new_eye) if(new_eye)
if(ismovable(new_eye)) if(ismovable(new_eye))
@@ -296,6 +298,8 @@
return FALSE return FALSE
if(isturf(loc)) // Cannot be remote if it was a turf, also obj and turf flags overlap so stepping into space triggers remoteview endlessly. if(isturf(loc)) // Cannot be remote if it was a turf, also obj and turf flags overlap so stepping into space triggers remoteview endlessly.
return FALSE return FALSE
if(QDELETED(loc))
return FALSE
// Check if we actually need to drop our current remote view component, as this is expensive to do, and leads to more difficult to understand error prone logic // Check if we actually need to drop our current remote view component, as this is expensive to do, and leads to more difficult to understand error prone logic
var/datum/component/remote_view/remote_comp = GetComponent(/datum/component/remote_view) var/datum/component/remote_view/remote_comp = GetComponent(/datum/component/remote_view)
if(remote_comp?.looking_at_target_already(loc)) if(remote_comp?.looking_at_target_already(loc))

View File

@@ -270,7 +270,9 @@ GLOBAL_LIST_EMPTY(all_waypoints)
. = TRUE . = TRUE
if("manual") if("manual")
if(!viewing_overmap(ui.user) && linked) if(check_eye(ui.user) < 0)
return FALSE
else if(!viewing_overmap(ui.user) && linked)
if(!viewers) viewers = list() // List must exist for pass by reference to work if(!viewers) viewers = list() // List must exist for pass by reference to work
start_coordinated_remoteview(ui.user, linked, viewers) start_coordinated_remoteview(ui.user, linked, viewers)
else else

View File

@@ -89,7 +89,9 @@
switch(action) switch(action)
if("viewing") if("viewing")
if(ui.user && !isAI(ui.user)) if(ui.user && !isAI(ui.user))
if(!viewing_overmap(ui.user) && linked) if(check_eye(ui.user) < 0)
. = FALSE
else if(!viewing_overmap(ui.user) && linked)
if(!viewers) viewers = list() // List must exist for pass by reference to work if(!viewers) viewers = list() // List must exist for pass by reference to work
start_coordinated_remoteview(ui.user, linked, viewers) start_coordinated_remoteview(ui.user, linked, viewers)
else else

View File

@@ -73,7 +73,9 @@
if(current_uav.check_eye(ui.user) < 0) if(current_uav.check_eye(ui.user) < 0)
to_chat(ui.user,span_warning("The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV.")) to_chat(ui.user,span_warning("The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV."))
else else
if(!viewing_uav(ui.user)) if(check_eye(ui.user) < 0)
return FALSE
else if(!viewing_uav(ui.user))
if(!viewers) viewers = list() // List must exist for pass by reference to work if(!viewers) viewers = list() // List must exist for pass by reference to work
start_coordinated_remoteview(ui.user, current_uav, viewers) start_coordinated_remoteview(ui.user, current_uav, viewers)
else else

View File

@@ -136,7 +136,9 @@
return FALSE return FALSE
if(action == "viewing") if(action == "viewing")
if(!viewing_overmap(ui.user)) if(check_eye(ui.user) < 0)
return FALSE
else if(!viewing_overmap(ui.user))
if(!viewers) viewers = list() // List must exist for pass by reference to work if(!viewers) viewers = list() // List must exist for pass by reference to work
start_coordinated_remoteview(ui.user, linked, viewers) start_coordinated_remoteview(ui.user, linked, viewers)
else else
@@ -400,7 +402,9 @@
. = TRUE . = TRUE
if("manual") if("manual")
if(!viewing_overmap(ui.user)) if(check_eye(ui.user) < 0)
return FALSE
else if(!viewing_overmap(ui.user))
if(!viewers) viewers = list() if(!viewers) viewers = list()
start_coordinated_remoteview(ui.user, linked, viewers) start_coordinated_remoteview(ui.user, linked, viewers)
else else