From fcb20bbdd4d24e92a45bb7ed9729eae45bee5cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 16 Aug 2025 11:02:35 +0200 Subject: [PATCH] Fix broken scripts that rely on P_GetMobjGravity without gravity --- src/lua_baselib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 6c8fa1d17..67c46b222 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -891,7 +891,13 @@ static int lib_pGetMobjGravity(lua_State *L) INLEVEL if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); + + // HACK: reset the gravity of the object to remain compatible with addons + // that lack a MF_NOGRAVITY check around the call. + fixed_t grav = mobj->gravity; + mobj->gravity = FRACUNIT; lua_pushfixed(L, P_GetMobjGravity(mobj)); + mobj->gravity = grav; return 1; }