mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 13:38:41 +01:00
Merge branch 'master' of https://github.com/tgstation/-tg-station into crafting-tgui
Conflicts: tgui/assets/tgui.css tgui/assets/tgui.js
This commit is contained in:
@@ -16,14 +16,22 @@
|
||||
**/
|
||||
/datum/proc/ui_status(mob/user, datum/ui_state/state)
|
||||
var/src_object = ui_host()
|
||||
. = UI_CLOSE
|
||||
if(!state)
|
||||
return
|
||||
|
||||
if(istype(user, /mob/dead/observer)) // Special-case ghosts.
|
||||
if(istype(user, /mob/dead/observer))
|
||||
// If they turn on ghost AI control, admins can always interact.
|
||||
if(IsAdminGhost(user))
|
||||
return UI_INTERACTIVE // If they turn it on, admins can interact.
|
||||
. = max(., UI_INTERACTIVE)
|
||||
|
||||
// Regular ghosts can always at least view if in range.
|
||||
if(get_dist(src_object, src) < user.client.view)
|
||||
return UI_UPDATE // Regular ghosts can only view.
|
||||
return UI_CLOSE // To keep too many UIs from being opened.
|
||||
return state.can_use_topic(src_object, user) // Check if the state allows interaction.
|
||||
. = max(., UI_UPDATE)
|
||||
|
||||
// Check if the state allows interaction
|
||||
var/result = state.can_use_topic(src_object, user)
|
||||
. = max(., result)
|
||||
|
||||
/**
|
||||
* private
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
/**
|
||||
* tgui state: human_adjacent_state
|
||||
*
|
||||
* In addition to default checks, only allows interaction for a
|
||||
* human adjacent user.
|
||||
**/
|
||||
|
||||
/var/global/datum/ui_state/human_adjacent_state/human_adjacent_state = new()
|
||||
|
||||
/datum/ui_state/human_adjacent_state/can_use_topic(src_object, mob/user)
|
||||
. = user.default_can_use_topic(src_object)
|
||||
|
||||
var/dist = get_dist(src_object, user)
|
||||
if((dist > 1) || (!ishuman(user)))
|
||||
// Can't be used unless adjacent and human, even with TK
|
||||
. = min(., UI_UPDATE)
|
||||
Reference in New Issue
Block a user