Files
Bubberstation/code/modules/tgui/states/human_adjacent.dm
Aleksej Komarov 0cf00a2645 tgui 4.0 (#52085)
* tgui 4.0 hyper squash

* Upgrade dependencies
2020-07-16 20:13:04 +02:00

20 lines
569 B
Plaintext

/**
* tgui state: human_adjacent_state
*
* In addition to default checks, only allows interaction for a
* human adjacent user.
*
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
*/
GLOBAL_DATUM_INIT(human_adjacent_state, /datum/ui_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)