diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 592157783..4c85f666c 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -5155,6 +5155,12 @@ function le_set_max_lights_per_vertex(count)
-- ...
end
+--- @param value boolean
+--- This will let the user control the lighting engine in real time to disable or enable it.
+function le_set_enabled(value)
+ -- ...
+end
+
--- @param pos Vec3f
--- @param out Color
--- @param lightIntensityScalar number
diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md
index 4bd956272..79aa91bb8 100644
--- a/docs/lua/functions-4.md
+++ b/docs/lua/functions-4.md
@@ -170,6 +170,29 @@ Sets the max amount of lights that can affect a vertex
+## [le_set_enabled](#le_set_enabled)
+
+### Description
+This will let the user control the lighting engine in real time to disable or enable it.
+
+### Lua Example
+`le_set_enabled(value)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| value | `boolean` |
+
+### Returns
+- None
+
+### C Prototype
+`void le_set_enabled(bool value);`
+
+[:arrow_up_small:](#)
+
+
+
## [le_calculate_lighting_color](#le_calculate_lighting_color)
### Description
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index e787f6b42..175a5b1ac 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -983,6 +983,7 @@
- [le_get_ambient_color](functions-4.md#le_get_ambient_color)
- [le_set_ambient_color](functions-4.md#le_set_ambient_color)
- [le_set_max_lights_per_vertex](functions-4.md#le_set_max_lights_per_vertex)
+ - [le_set_enabled](functions-4.md#le_set_enabled)
- [le_calculate_lighting_color](functions-4.md#le_calculate_lighting_color)
- [le_calculate_lighting_color_with_normal](functions-4.md#le_calculate_lighting_color_with_normal)
- [le_calculate_lighting_dir](functions-4.md#le_calculate_lighting_dir)
diff --git a/src/engine/lighting_engine.cpp b/src/engine/lighting_engine.cpp
index 0a12b55d5..74b1e9560 100644
--- a/src/engine/lighting_engine.cpp
+++ b/src/engine/lighting_engine.cpp
@@ -92,6 +92,10 @@ C_FIELD void le_set_max_lights_per_vertex(u8 count) {
sMaxLightsPerVertex = count;
}
+C_FIELD void le_set_enabled(bool value) {
+ sEnabled = value;
+}
+
static inline void le_tone_map_total_weighted(Color out, Color inAmbient, Vec3f inColor, f32 weight) {
out[0] = clamp_u8((inAmbient[0] + inColor[0]) / weight);
out[1] = clamp_u8((inAmbient[1] + inColor[1]) / weight);
diff --git a/src/engine/lighting_engine.h b/src/engine/lighting_engine.h
index cc0d4d725..b51fa4236 100644
--- a/src/engine/lighting_engine.h
+++ b/src/engine/lighting_engine.h
@@ -37,6 +37,8 @@ void le_get_ambient_color(VEC_OUT Color out);
void le_set_ambient_color(u8 r, u8 g, u8 b);
/* |description|Sets the max amount of lights that can affect a vertex|descriptionEnd| */
void le_set_max_lights_per_vertex(u8 count);
+/* |description|This will let the user control the lighting engine in real time to disable or enable it. |descriptionEnd|*/
+void le_set_enabled(bool value);
void le_calculate_vertex_lighting(const Vtx_t* v, Vec3f pos, VEC_OUT Color out);
/* |description|Calculates the lighting with `lightIntensityScalar` at a position and outputs the color in `out`|descriptionEnd|*/
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 78af5534d..5e63771a8 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -15657,6 +15657,23 @@ int smlua_func_le_set_max_lights_per_vertex(lua_State* L) {
return 1;
}
+int smlua_func_le_set_enabled(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 1) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "le_set_enabled", 1, top);
+ return 0;
+ }
+
+ bool value = smlua_to_boolean(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_set_enabled"); return 0; }
+
+ le_set_enabled(value);
+
+ return 1;
+}
+
int smlua_func_le_calculate_lighting_color(lua_State* L) {
if (L == NULL) { return 0; }
@@ -37809,6 +37826,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "le_get_ambient_color", smlua_func_le_get_ambient_color);
smlua_bind_function(L, "le_set_ambient_color", smlua_func_le_set_ambient_color);
smlua_bind_function(L, "le_set_max_lights_per_vertex", smlua_func_le_set_max_lights_per_vertex);
+ smlua_bind_function(L, "le_set_enabled", smlua_func_le_set_enabled);
smlua_bind_function(L, "le_calculate_lighting_color", smlua_func_le_calculate_lighting_color);
smlua_bind_function(L, "le_calculate_lighting_color_with_normal", smlua_func_le_calculate_lighting_color_with_normal);
smlua_bind_function(L, "le_calculate_lighting_dir", smlua_func_le_calculate_lighting_dir);