Files
Batrachophreno cde601b021 TGUI Fixes, Did You Think I Was Done Edition (#22641)
Fixes https://github.com/Aurorastation/Aurora.3/issues/15357
Fixes https://github.com/Aurorastation/Aurora.3/issues/22459
Fixes https://github.com/Aurorastation/Aurora.3/issues/22593
Fixes https://github.com/Aurorastation/Aurora.3/issues/22634

changes:
- bugfix: "Restores chat highlight background color selection
functionality (PR #20701)"
  - bugfix: "Restores customizable chat message retention settings."
  - bugfix: "Updates recommended vscode extension config file."
- bugfix: "Corrects some mismapped and missing scss files as well as
removing temporary working files leftover in PR."
- bugfix: "Fixes silicons/AI being unable to interact remotely with
shield capacitor and shield generator machinery."
- bugfix: "Fixes gene data disks produced by xenobotany's
lysis-isolation centrifuge machine not displaying gene names."
  - bugfix: "Makes AI remote access to machinery TGUIs more consistent."
- bugfix: "Fixes the Sensors interface not displaying sensor machinery's
current health."
- bugfix: "Fixes the Sensors interface displaying strange values for
current range."
- bugfix: "Fixes modular computer software displaying device themes
instead of explicit software themes."
  - bugfix: "Fixes MC tab links."
  - spellcheck: "Fixes a typo in the TGUI fatal error message."
2026-06-07 00:16:53 +02:00

85 lines
2.9 KiB
Plaintext

/*!
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
*/
/**
* tgui state: default_state
*
* Checks a number of things -- mostly physical distance for humans
* and view for robots.
*/
GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new)
/datum/ui_state/default/can_use_topic(src_object, mob/user)
return user?.default_can_use_topic(src_object) // Call the individual mob-overridden procs.
/mob/proc/default_can_use_topic(src_object)
return UI_CLOSE // Don't allow interaction by default.
/mob/abstract/eye/freelook/aiEye/default_can_use_topic(src_object)
if(!isAI(owner))
return UI_CLOSE
var/mob/living/silicon/ai/ai = owner
return ai.default_can_use_topic(src_object)
/mob/living/default_can_use_topic(src_object)
. = shared_ui_interaction(src_object)
if(. > UI_CLOSE && loc) //must not be in nullspace.
. = min(., shared_living_ui_distance(src_object)) // Check the distance...
if(. == UI_INTERACTIVE && !src.IsAdvancedToolUser()) // unhandy living mobs can only look, not touch.
return UI_UPDATE
/mob/living/silicon/robot/default_can_use_topic(src_object)
. = shared_ui_interaction(src_object)
if(. <= UI_DISABLED)
return
// Robots can interact with anything they can see.
var/list/clientviewlist = getviewsize(client.view)
if(get_dist(src, src_object) <= min(clientviewlist[1],clientviewlist[2]))
return UI_INTERACTIVE
return UI_DISABLED // Otherwise they can keep the UI open.
/mob/living/silicon/ai/default_can_use_topic(src_object)
. = shared_ui_interaction(src_object)
if(. < UI_INTERACTIVE)
return
// The AI can interact with anything visible from its eye while wireless control is enabled.
if(can_use_remote_ui(src_object))
return UI_INTERACTIVE
return UI_CLOSE
/mob/living/silicon/pai/default_can_use_topic(src_object)
// pAIs can use themselves, the owner's radio, and any computer they're inserted into. Limited by synced ID for certain programs.
if((src_object == src || src_object == radio) && !stat)
return UI_INTERACTIVE
else if(src_object == src.parent_computer)
if(istype(src_object, /obj/item/modular_computer))
var/obj/item/modular_computer/PDA = src_object
if(PDA.pAI_lock == FALSE)
return UI_INTERACTIVE
else
to_chat(src, SPAN_WARNING("Access denied."))
return min(..(), UI_UPDATE)
/mob/living/simple_animal/spiderbot/default_can_use_topic(src_object)
if(ismech(src_object))
return UI_INTERACTIVE
return ..()
/mob/living/carbon/human/default_can_use_topic(src_object)
. = ..()
var/obj/item/organ/internal/machine/wireless_access/access_point = internal_organs_by_name[BP_WIRELESS_ACCESS]
if(istype(access_point))
// Just like robots, these IPCs can interact with anything they can see.
var/list/clientviewlist = getviewsize(client.view)
if(get_dist(src, src_object) <= min(clientviewlist[1], clientviewlist[2]))
return UI_INTERACTIVE
return UI_DISABLED // Otherwise they can keep the UI open.