mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-16 18:01:40 +00:00
Add minetest.register_lbm() to run code on block load only
This commit is contained in:
parent
88fbe7ca1e
commit
d494733839
12 changed files with 493 additions and 25 deletions
|
@ -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<std::string> &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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue