Refactor GLOB.admin/debug/fun_state into cached /datum/ui_state/admin_state instances (#89417)

## About The Pull Request

So, some admin verbs/tools that used tguis, i.e edit/debug planes, were
available to admins with +DEBUG... but the ui_state used
`GLOB.admin_state`, which checks for +ADMIN - meaning that if they
_only_ had +DEBUG, they would have the verb... but it would do nothing
when they used it.

I've refactored `GLOB.admin_state`, `GLOB.debug_state`, and
`GLOB.fun_state` into a merged `/datum/ui_state/admin_state`, with a var
for which specific permissions are being checked for.

You now use the `ADMIN_STATE(perms)` macro to get the UI state for those
specific perms, i.e `admin_state(R_ADMIN)` or `admin_state(R_DEBUG)`,
and the resulting UI state will check for _those specific perms_.

These are initialized and cached in `GLOB.admin_states` (which should
never be directly accessed).

So, I've went thru every single usage of `GLOB.admin_state`,
`GLOB.fun_state`, and `GLOB.debug_state`, and made them all use
`ADMIN_STATE()` with the actual permission flags needed to use said UI
in the first place.

## Why It's Good For The Game

Kinda dumb for specific admin permissions to be granted verbs that don't
let them use it anyways.

## Changelog
🆑
admin: Certain UI-based tools (plane debugger, filter editor, etc) that
were given to admins with only +VAREDIT or +DEBUG, but refused to open
without +ADMIN, now actually work for admins that have the needed
permission.
/🆑
This commit is contained in:
Lucy
2025-02-16 23:54:00 +00:00
committed by GitHub
parent f3551e03c2
commit d656f0f4ec
40 changed files with 61 additions and 64 deletions
+1 -1
View File
@@ -42,7 +42,7 @@
LAZYREMOVEASSOC(SSlua.editors, text_ref(current_state), src)
/datum/lua_editor/ui_state(mob/user)
return GLOB.debug_state
return ADMIN_STATE(R_DEBUG)
/datum/lua_editor/ui_data(mob/user)
var/list/data = list()