From d494733839e9cf6cb557462326ed21e7a58816c7 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 9 Feb 2016 07:08:31 +0100 Subject: Add minetest.register_lbm() to run code on block load only --- src/script/lua_api/l_env.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/script/lua_api/l_env.h') diff --git a/src/script/lua_api/l_env.h b/src/script/lua_api/l_env.h index 4f8dfcd3c..0e385ffef 100644 --- a/src/script/lua_api/l_env.h +++ b/src/script/lua_api/l_env.h @@ -220,6 +220,24 @@ public: u32 active_object_count, u32 active_object_count_wider); }; +class LuaLBM : public LoadingBlockModifierDef +{ +private: + int m_id; +public: + LuaLBM(lua_State *L, int id, + const std::set &trigger_contents, + const std::string &name, + bool run_at_every_load): + m_id(id) + { + this->run_at_every_load = run_at_every_load; + this->trigger_contents = trigger_contents; + this->name = name; + } + virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n); +}; + struct ScriptCallbackState { GameScripting *script; int callback_ref; -- cgit v1.2.3