Files
Bubberstation/code/modules/tgui/states/admin.dm
Lucy df31bddd9d Change GLOB.admin_states to be an alist (#91853)
## About The Pull Request

this changes `GLOB.admin_states` to be an alist instead of a normal
list, so we don't have to convert stringify `required_perms` to use as a
key.

## Why It's Good For The Game


https://github.com/user-attachments/assets/9baa6aff-65d3-42b6-be29-73b2dbc6bdff
2025-06-29 13:21:31 -05:00

32 lines
787 B
Plaintext

/*!
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
*/
/**
* tgui state: admin_state
*
* Checks if the user has specific admin permissions.
*/
GLOBAL_DATUM_INIT(admin_states, /alist, alist())
GLOBAL_PROTECT(admin_states)
/datum/ui_state/admin_state
/// The specific admin permissions required for the UI using this state.
VAR_FINAL/required_perms = R_ADMIN
/datum/ui_state/admin_state/New(required_perms = R_ADMIN)
. = ..()
src.required_perms = required_perms
/datum/ui_state/admin_state/can_use_topic(src_object, mob/user)
if(check_rights_for(user.client, required_perms))
return UI_INTERACTIVE
return UI_CLOSE
/datum/ui_state/admin_state/vv_edit_var(var_name, var_value)
if(var_name == NAMEOF(src, required_perms))
return FALSE
return ..()