diff --git a/code/__DEFINES/configuration.dm b/code/__DEFINES/configuration.dm index 8e9cde8a2bf..81965514fcb 100644 --- a/code/__DEFINES/configuration.dm +++ b/code/__DEFINES/configuration.dm @@ -6,9 +6,9 @@ //flags /// can't edit -#define CONFIG_ENTRY_LOCKED 1 +#define CONFIG_ENTRY_LOCKED (1<<0) /// can't see value -#define CONFIG_ENTRY_HIDDEN 2 +#define CONFIG_ENTRY_HIDDEN (1<<1) /// Force the config directory to be something other than "config" #define OVERRIDE_CONFIG_DIRECTORY_PARAMETER "config-directory" diff --git a/code/__HELPERS/_auxtools_api.dm b/code/__HELPERS/_auxtools_api.dm index b599fd31215..8dbd58f2eed 100644 --- a/code/__HELPERS/_auxtools_api.dm +++ b/code/__HELPERS/_auxtools_api.dm @@ -2,8 +2,12 @@ #define AUXTOOLS_PARTIAL_INIT 1 GLOBAL_LIST_EMPTY(auxtools_initialized) +GLOBAL_PROTECT(auxtools_initialized) #define AUXTOOLS_CHECK(LIB)\ + if (!CONFIG_GET(flag/auxtools_enabled)) {\ + CRASH("Auxtools is not enabled in config!");\ + }\ if (GLOB.auxtools_initialized[LIB] != AUXTOOLS_FULL_INIT) {\ if (fexists(LIB)) {\ var/string = LIBCALL(LIB,"auxtools_init")();\ diff --git a/code/controllers/configuration/entries/lua.dm b/code/controllers/configuration/entries/lua.dm index fdfe5871165..549696543c1 100644 --- a/code/controllers/configuration/entries/lua.dm +++ b/code/controllers/configuration/entries/lua.dm @@ -1,2 +1,5 @@ /datum/config_entry/str_list/lua_path protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/flag/auxtools_enabled + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN diff --git a/code/modules/admin/verbs/lua/lua_editor.dm b/code/modules/admin/verbs/lua/lua_editor.dm index 75d05c0a557..d8a414f4685 100644 --- a/code/modules/admin/verbs/lua/lua_editor.dm +++ b/code/modules/admin/verbs/lua/lua_editor.dm @@ -40,10 +40,15 @@ /datum/lua_editor/ui_static_data(mob/user) var/list/data = list() data["documentation"] = file2text('code/modules/admin/verbs/lua/README.md') + data["auxtools_enabled"] = CONFIG_GET(flag/auxtools_enabled) + data["ss_lua_init"] = SSlua.initialized return data /datum/lua_editor/ui_data(mob/user) var/list/data = list() + if(!CONFIG_GET(flag/auxtools_enabled) || !SSlua.initialized) + return data + data["noStateYet"] = !current_state data["showGlobalTable"] = show_global_table if(current_state) @@ -227,8 +232,5 @@ set category = "Debug" if(!check_rights_for(src, R_DEBUG)) return - if(SSlua.initialized != TRUE) - to_chat(usr, span_warning("SSlua is not initialized!")) - return var/datum/lua_editor/editor = new() editor.ui_interact(usr) diff --git a/config/auxtools.txt b/config/auxtools.txt new file mode 100644 index 00000000000..369480c0b86 --- /dev/null +++ b/config/auxtools.txt @@ -0,0 +1,6 @@ +## +## Master config flag for enabling/disabling auxtools. +## Currently, this will disable Lua scripting. +## + +#AUXTOOLS_ENABLED diff --git a/config/config.txt b/config/config.txt index 8a217d61292..d66eaf0942e 100644 --- a/config/config.txt +++ b/config/config.txt @@ -6,6 +6,7 @@ $include comms.txt $include resources.txt $include interviews.txt $include lua.txt +$include auxtools.txt # You can use the @ character at the beginning of a config option to lock it from being edited in-game # Example usage: diff --git a/tgui/packages/tgui/interfaces/LuaEditor/index.js b/tgui/packages/tgui/interfaces/LuaEditor/index.js index d304cb703f8..bb4329870aa 100644 --- a/tgui/packages/tgui/interfaces/LuaEditor/index.js +++ b/tgui/packages/tgui/interfaces/LuaEditor/index.js @@ -1,5 +1,5 @@ import { useBackend, useLocalState } from '../../backend'; -import { Box, Button, Flex, Section, Tabs, TextArea, Modal, Stack, ProgressBar } from '../../components'; +import { Box, Button, Flex, Section, Tabs, TextArea, Modal, Stack, ProgressBar, NoticeBox } from '../../components'; import { Window } from '../../layouts'; import { CallModal } from './CallModal'; import { ChunkViewModal } from './ChunkViewModal'; @@ -72,7 +72,35 @@ export class LuaEditor extends Component { showGlobalTable, page, pageCount, + auxtools_enabled, + ss_lua_init, } = data; + + if (!auxtools_enabled) { + return ( + + + + Auxtools is not enabled. Please ask your server administrator to + enable it in the server configuration. + + + + ); + } + + if (!ss_lua_init) { + return ( + + + + The Lua subsystem is not initialized. Consult your server logs. + + + + ); + } + const [modal, setModal] = useLocalState( this.context, 'modal', diff --git a/tools/ci/ci_config.txt b/tools/ci/ci_config.txt index 4925d781bbb..51e08e6328b 100644 --- a/tools/ci/ci_config.txt +++ b/tools/ci/ci_config.txt @@ -7,3 +7,4 @@ FEEDBACK_LOGIN root FEEDBACK_PASSWORD LAVALAND_BUDGET 0 SPACE_BUDGET 0 +AUXTOOLS_ENABLED