diff --git a/code/modules/tgui/states.dm b/code/modules/tgui/states.dm index 188fb7f48a1..dbe06fb241a 100644 --- a/code/modules/tgui/states.dm +++ b/code/modules/tgui/states.dm @@ -86,6 +86,11 @@ return UI_DISABLED return ..() +/** + * Handles remote view for AIs. + * To open a UI, the AI needs to be able to see the source machine on cameras. + * If a camera is disabled while the AI is viewing a machine's UI, the UI closes. + */ /mob/living/silicon/ai/proc/can_use_remote_ui(src_object) if(src_object == src) return TRUE @@ -93,29 +98,10 @@ if(control_disabled || !istype(src_object, /atom)) return FALSE - var/atom/source = src_object - var/atom/interaction_source = eyeobj || src - var/turf/interaction_turf = get_turf(interaction_source) - var/turf/source_turf = get_turf(source) - if(!interaction_turf || !source_turf || interaction_turf.z != source_turf.z) - return FALSE - - var/view_setting = world.view - if(client) - view_setting = client.view - - var/list/clientviewlist = getviewsize(view_setting) - var/x_range = round((clientviewlist[1] - 1) / 2) - var/y_range = round((clientviewlist[2] - 1) / 2) - if(!IsInRange(source_turf.x, interaction_turf.x - x_range, interaction_turf.x + x_range)) - return FALSE - if(!IsInRange(source_turf.y, interaction_turf.y - y_range, interaction_turf.y + y_range)) - return FALSE - - return can_see(interaction_source, source, max(x_range, y_range)) + return GLOB.cameranet.is_visible(src_object) +/// Disable UIs if the object isn't installed in the borg AND the borg has a dead cell, or no cell. /mob/living/silicon/robot/shared_ui_interaction(src_object) - // Disable UIs if the object isn't installed in the borg AND the borg has a dead cell, or no cell. var/atom/device = src_object if((istype(device) && device.loc != src) && (!cell || cell.charge <= 0)) return UI_DISABLED diff --git a/html/changelogs/example copy.yml b/html/changelogs/example copy.yml new file mode 100644 index 00000000000..916a4c5f4bf --- /dev/null +++ b/html/changelogs/example copy.yml @@ -0,0 +1,58 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: Benbot16 + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Changes AI UI logic to check for camera view instead of the AI eye's view when determining whether a machine's UI should be viewable."