mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
@@ -103,8 +103,8 @@
|
||||
*
|
||||
* return UI_state The state of the UI.
|
||||
**/
|
||||
/mob/living/proc/shared_living_ui_distance(atom/movable/src_object)
|
||||
if(!(src_object in view(src))) // If the object is obscured, close it.
|
||||
/mob/living/proc/shared_living_ui_distance(atom/movable/src_object, viewcheck = TRUE)
|
||||
if(viewcheck && !(src_object in view(src))) // If the object is obscured, close it.
|
||||
return UI_CLOSE
|
||||
|
||||
var/dist = get_dist(src_object, src)
|
||||
@@ -116,7 +116,7 @@
|
||||
return UI_DISABLED
|
||||
return UI_CLOSE // Otherwise, we got nothing.
|
||||
|
||||
/mob/living/carbon/human/shared_living_ui_distance(atom/movable/src_object)
|
||||
/mob/living/carbon/human/shared_living_ui_distance(atom/movable/src_object, viewcheck = TRUE)
|
||||
if(dna.check_mutation(TK) && tkMaxRangeCheck(src, src_object))
|
||||
return UI_INTERACTIVE
|
||||
return ..()
|
||||
|
||||
@@ -22,3 +22,29 @@ GLOBAL_DATUM_INIT(physical_state, /datum/ui_state/physical, new)
|
||||
|
||||
/mob/living/silicon/ai/physical_can_use_topic(src_object)
|
||||
return UI_UPDATE // AIs are not physical.
|
||||
|
||||
|
||||
/**
|
||||
* tgui state: physical_obscured_state
|
||||
*
|
||||
* Short-circuits the default state to only check physical distance, being in view doesn't matter
|
||||
**/
|
||||
|
||||
GLOBAL_DATUM_INIT(physical_obscured_state, /datum/ui_state/physical_obscured_state, new)
|
||||
|
||||
/datum/ui_state/physical_obscured_state/can_use_topic(src_object, mob/user)
|
||||
. = user.shared_ui_interaction(src_object)
|
||||
if(. > UI_CLOSE)
|
||||
return min(., user.physical_obscured_can_use_topic(src_object))
|
||||
|
||||
/mob/proc/physical_obscured_can_use_topic(src_object)
|
||||
return UI_CLOSE
|
||||
|
||||
/mob/living/physical_obscured_can_use_topic(src_object)
|
||||
return shared_living_ui_distance(src_object, viewcheck = FALSE)
|
||||
|
||||
/mob/living/silicon/physical_obscured_can_use_topic(src_object)
|
||||
return max(UI_UPDATE, shared_living_ui_distance(src_object, viewcheck = FALSE)) // Silicons can always see.
|
||||
|
||||
/mob/living/silicon/ai/physical_obscured_can_use_topic(src_object)
|
||||
return UI_UPDATE // AIs are not physical.
|
||||
|
||||
Reference in New Issue
Block a user