Fix inventory bugs and add tgui state

This commit is contained in:
Aronai Sieyes
2021-07-03 22:12:52 -04:00
parent fda5bd4c7f
commit ba76d87604
5 changed files with 33 additions and 11 deletions
+1 -1
View File
@@ -119,7 +119,7 @@
return STATUS_DISABLED
return STATUS_CLOSE // Otherwise, we got nothing.
/mob/living/carbon/human/shared_living_tgui_distance(atom/movable/src_object)
/mob/living/carbon/human/shared_living_tgui_distance(atom/movable/src_object, viewcheck = TRUE)
if((TK in mutations) && (get_dist(src, src_object) <= 2))
return STATUS_INTERACTIVE
return ..()
+25
View File
@@ -22,3 +22,28 @@ GLOBAL_DATUM_INIT(tgui_physical_state, /datum/tgui_state/physical, new)
/mob/living/silicon/ai/physical_can_use_tgui_topic(src_object)
return STATUS_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(tgui_physical_obscured_state, /datum/tgui_state/physical_obscured_state, new)
/datum/tgui_state/physical_obscured_state/can_use_topic(src_object, mob/user)
. = user.shared_tgui_interaction(src_object)
if(. > STATUS_CLOSE)
return min(., user.physical_obscured_can_use_topic(src_object))
/mob/proc/physical_obscured_can_use_topic(src_object)
return STATUS_CLOSE
/mob/living/physical_obscured_can_use_topic(src_object)
return shared_living_tgui_distance(src_object, viewcheck = FALSE)
/mob/living/silicon/physical_obscured_can_use_topic(src_object)
return max(STATUS_UPDATE, shared_living_tgui_distance(src_object, viewcheck = FALSE)) // Silicons can always see.
/mob/living/silicon/ai/physical_obscured_can_use_topic(src_object)
return STATUS_UPDATE // AIs are not physical.