From 58a6b7e019f758dda4528313b3017998400f8f7f Mon Sep 17 00:00:00 2001 From: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com> Date: Fri, 1 May 2026 12:51:36 +0200 Subject: [PATCH] Remove dead code in custom geo and bhv functions - Custom geo asm and custom behaviors were meant to use any non-local function from any active mod, but the condition for it was always false (gSmLuaConvertSuccess is never set to false and funcRef is not checked) - By default, they should NOT be able to retrieve anything from other mods - Even without this condition, they are still allowed to use any function exposed to _G Approved by Isaac. --- src/engine/behavior_script.c | 6 ------ src/game/mario_misc.c | 4 ---- 2 files changed, 10 deletions(-) diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c index a9c827b77..054e773f4 100644 --- a/src/engine/behavior_script.c +++ b/src/engine/behavior_script.c @@ -1004,12 +1004,6 @@ static s32 bhv_cmd_call_native_ext(void) { gSmLuaConvertSuccess = true; LuaFunction funcRef = smlua_get_function_mod_variable(modIndex, funcStr); - - if (!gSmLuaConvertSuccess) { - gSmLuaConvertSuccess = true; - funcRef = smlua_get_any_function_mod_variable(funcStr); - } - if (!gSmLuaConvertSuccess || funcRef == 0) { LOG_LUA("Failed to call lua behavior function, could not find lua function '%s'", funcStr); gCurBhvCommand += 2; diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index b60cac7c7..08f18ffb1 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -890,10 +890,6 @@ Gfx *geo_process_lua_function(s32 callContext, struct GraphNode *node, UNUSED Ma // Retrieve function ref gSmLuaConvertSuccess = true; LuaFunction funcRef = smlua_get_function_mod_variable(modIndex, funcStr); - if (!gSmLuaConvertSuccess) { - gSmLuaConvertSuccess = true; - funcRef = smlua_get_any_function_mod_variable(funcStr); - } if (!gSmLuaConvertSuccess || funcRef == 0) { LOG_LUA("Failed to call lua geo function, could not find lua function '%s'", funcStr); return NULL;