1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Expose dtime_s to LBM handler

This commit is contained in:
sfan5 2022-12-04 12:35:14 +01:00 committed by GitHub
parent aa3505a9e4
commit 37386b9c3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 9 deletions

View file

@ -109,7 +109,8 @@ void LuaABM::trigger(ServerEnvironment *env, v3s16 p, MapNode n,
lua_pop(L, 1); // Pop error handler
}
void LuaLBM::trigger(ServerEnvironment *env, v3s16 p, MapNode n)
void LuaLBM::trigger(ServerEnvironment *env, v3s16 p,
const MapNode n, const float dtime_s)
{
ServerScripting *scriptIface = env->getScriptIface();
scriptIface->realityCheck();
@ -141,8 +142,9 @@ void LuaLBM::trigger(ServerEnvironment *env, v3s16 p, MapNode n)
lua_remove(L, -2); // Remove registered_lbms[m_id]
push_v3s16(L, p);
pushnode(L, n);
lua_pushnumber(L, dtime_s);
int result = lua_pcall(L, 2, 0, error_handler);
int result = lua_pcall(L, 3, 0, error_handler);
if (result)
scriptIface->scriptError(result, "LuaLBM::trigger");

View file

@ -287,7 +287,7 @@ public:
this->trigger_contents = trigger_contents;
this->name = name;
}
virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n);
virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n, float dtime_s);
};
//! Lua wrapper for RaycastState objects