Add a DISABLE_DREAMLUAU define, for disabling dreamluau at compile-time (#89359)

## About The Pull Request

this adds a new define, `DISABLE_DREAMLUAU` (commented out by default),
which does... exactly what it says on the tin. it fully disables any
dreamluau-related code (the "Open Lua Editor" admin verb is left in,
albeit just giving the user a warning saying Lua is disabled, just so
there's no confusion about the verb itself being missing)

when compiling with OpenDream outside of CI (so dreamluau code will
still be linted), `DISABLE_DREAMLUAU` will be defined by default, tho.

## Why It's Good For The Game

makes OpenDream testing easier

## Changelog

no user-facing changes. or even code changes for most cases.
This commit is contained in:
Lucy
2025-02-05 20:27:55 -05:00
committed by GitHub
parent 0261ad2997
commit 348413a8a6
14 changed files with 42 additions and 0 deletions
@@ -1,3 +1,4 @@
#ifndef DISABLE_DREAMLUAU
/proc/wrap_lua_get_var(datum/thing, var_name)
SHOULD_NOT_SLEEP(TRUE)
if(thing == world)
@@ -46,3 +47,4 @@
var/result = list("status" = "print", "message" = print_message)
INVOKE_ASYNC(target_state, TYPE_PROC_REF(/datum/lua_state, log_result), result, TRUE)
log_lua("[target_state]: [print_message]")
#endif
+2
View File
@@ -1,3 +1,4 @@
#ifndef DISABLE_DREAMLUAU
#define PROMISE_PENDING 0
#define PROMISE_RESOLVED 1
#define PROMISE_REJECTED 2
@@ -34,3 +35,4 @@
#undef PROMISE_PENDING
#undef PROMISE_RESOLVED
#undef PROMISE_REJECTED
#endif
@@ -1,3 +1,4 @@
#ifndef DISABLE_DREAMLUAU
/datum/lua_editor
var/datum/lua_state/current_state
@@ -279,7 +280,12 @@
/datum/lua_editor/ui_close(mob/user)
. = ..()
qdel(src)
#endif
ADMIN_VERB(lua_editor, R_DEBUG, "Open Lua Editor", "Its codin' time.", ADMIN_CATEGORY_DEBUG)
#ifndef DISABLE_DREAMLUAU
var/datum/lua_editor/editor = new
editor.ui_interact(user.mob)
#else
to_chat(user, span_warning("Lua support has been disabled at compile-time."), type = MESSAGE_TYPE_ADMINLOG, confidential = TRUE) // doing this instead of just disabling the verb entirely so it's clear WHY it doesn't work.
#endif
@@ -1,3 +1,4 @@
#ifndef DISABLE_DREAMLUAU
#define MAX_LOG_REPEAT_LOOKBACK 5
GLOBAL_DATUM(lua_usr, /mob)
@@ -232,3 +233,4 @@ GLOBAL_PROTECT(lua_state_stack)
SStgui.update_uis(editor)
#undef MAX_LOG_REPEAT_LOOKBACK
#endif