diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 5424ab6399d6..ba84f1cca76d 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -188,37 +188,38 @@ clean_observe_target() /// When the observer target gets a screen, our observer gets a screen minus some game screens we don't want the observer to touch -/mob/dead/observer/proc/observe_target_screen_add(observe_target_mob_client, add_to_screen) +/mob/dead/observer/proc/observe_target_screen_add(observe_target_mob_client, screen_add) SIGNAL_HANDLER - if(!client) - return - - if(istype(add_to_screen, /atom/movable/screen/action_button)) - return - - if(istype(add_to_screen, /atom/movable/screen/fullscreen)) - return + var/static/list/excluded_types = typecacheof(list( + /atom/movable/screen/fullscreen, + /atom/movable/screen/click_catcher, + /atom/movable/screen/escape_menu, + /atom/movable/screen/buildmode, + /obj/effect/detector_blip, + )) - if(istype(add_to_screen, /atom/movable/screen/click_catcher)) + if(!client) return - if(istype(add_to_screen, /atom/movable/screen/escape_menu)) - return + // `screen_add` can sometimes be a list, so it's safest to just handle everything as one. + var/list/stuff_to_add = (islist(screen_add) ? screen_add : list(screen_add)) - if(istype(add_to_screen, /obj/effect/detector_blip)) - return + for(var/item in stuff_to_add) + // Ignore anything that's in `excluded_types`. + if(is_type_in_typecache(item, excluded_types)) + continue - client.add_to_screen(add_to_screen) + client.add_to_screen(screen_add) /// When the observer target loses a screen, our observer loses it as well -/mob/dead/observer/proc/observe_target_screen_remove(observe_target_mob_client, remove_from_screen) +/mob/dead/observer/proc/observe_target_screen_remove(observe_target_mob_client, screen_remove) SIGNAL_HANDLER if(!client) return - client.remove_from_screen(remove_from_screen) + client.remove_from_screen(screen_remove) /// When the observe target ghosts our observer disconnect from their screen updates /mob/dead/observer/proc/observe_target_ghosting(mob/observer_target_mob) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 69f9b904044d..bb88338d8db9 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -317,25 +317,22 @@ /mob/living/carbon/human/auto_observed(mob/dead/observer/observer) . = ..() - var/list/all_contents = get_contents() - - // Handle any currently open storage containers `src` is looking at when observed. - for(var/obj/item/storage/checked_storage in all_contents) - if(!(src in checked_storage.content_watchers)) - continue + // If `src` doesn't have an inventory open. + if(!s_active) + return - observer.client.add_to_screen(checked_storage.closer) - observer.client.add_to_screen(checked_storage.contents) + // Add the storage interface to `observer`'s screen. + observer.client.add_to_screen(s_active.closer) + observer.client.add_to_screen(s_active.contents) - if(checked_storage.storage_slots) - observer.client.add_to_screen(checked_storage.boxes) - else - observer.client.add_to_screen(checked_storage.storage_start) - observer.client.add_to_screen(checked_storage.storage_continue) - observer.client.add_to_screen(checked_storage.storage_end) - - // Players are only able to look in one inventory at a time, so skip any others. - break + // If the storage has a set number of item slots. + if(s_active.storage_slots) + observer.client.add_to_screen(s_active.boxes) + // If the storage instead has a maximum combined item 'weight'. + else + observer.client.add_to_screen(s_active.storage_start) + observer.client.add_to_screen(s_active.storage_continue) + observer.client.add_to_screen(s_active.storage_end) // called when something steps onto a human // this handles mulebots and vehicles