Files
Hyper-Station-13/code/modules/tgui/states/not_incapacitated.dm
T
sarcoph 66962a8816 first attempt at implementing TGUI 3
trying to update from TGUI Next to TGUI 3, so we can later upgrade from TGUI 3 to TGUI 4.
2022-02-26 16:43:25 -09:00

30 lines
834 B
Plaintext

/**
* tgui state: not_incapacitated_state
*
* Checks that the user isn't incapacitated
**/
GLOBAL_DATUM_INIT(tgui_not_incapacitated_state, /datum/tgui_state/not_incapacitated_state, new)
/**
* tgui state: not_incapacitated_turf_state
*
* Checks that the user isn't incapacitated and that their loc is a turf
**/
GLOBAL_DATUM_INIT(tgui_not_incapacitated_turf_state, /datum/tgui_state/not_incapacitated_state, new(no_turfs = TRUE))
/datum/tgui_state/not_incapacitated_state
var/turf_check = FALSE
/datum/tgui_state/not_incapacitated_state/New(loc, no_turfs = FALSE)
..()
turf_check = no_turfs
/datum/tgui_state/not_incapacitated_state/can_use_topic(src_object, mob/user)
if(user.stat)
return UI_CLOSE
if(user.incapacitated() || (turf_check && !isturf(user.loc)))
return UI_DISABLED
return UI_INTERACTIVE