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 --- builtin/game/register.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/game/register.lua b/builtin/game/register.lua index 398daf057..f330491a2 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -11,10 +11,11 @@ local register_alias_raw = core.register_alias_raw core.register_alias_raw = nil -- --- Item / entity / ABM registration functions +-- Item / entity / ABM / LBM registration functions -- core.registered_abms = {} +core.registered_lbms = {} core.registered_entities = {} core.registered_items = {} core.registered_nodes = {} @@ -79,6 +80,13 @@ function core.register_abm(spec) spec.mod_origin = core.get_current_modname() or "??" end +function core.register_lbm(spec) + -- Add to core.registered_lbms + check_modname_prefix(spec.name) + core.registered_lbms[#core.registered_lbms + 1] = spec + spec.mod_origin = core.get_current_modname() or "??" +end + function core.register_entity(name, prototype) -- Check name if name == nil then -- cgit v1.2.3