mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-18 11:30:35 +01:00
Updates AI UI handling to use the cameranet instead of the AI eye (#22745)
This PR tweaks an AI's can_use_remote_ui() proc to check for cameranet visibility instead of distance to an AI's eye. This allows an AI to use machines that aren't visible from the eye due to dense objects, but are still visible from cameras. It also keeps the UI window open if the AI's eye moves away, and closes the UI window if the viewing camera is disabled or destroyed. Fixes #22726
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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."
|
||||
Reference in New Issue
Block a user