aboutsummaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-02-09 07:08:31 +0100
committerest31 <MTest31@outlook.com>2016-03-07 19:54:26 +0100
commitd494733839e9cf6cb557462326ed21e7a58816c7 (patch)
tree07ead00672b0096aa2a60938b769bf030bba2951 /builtin/game
parent88fbe7ca1e5451851ee0c7ab5524c39a7bb703c2 (diff)
downloadminetest-d494733839e9cf6cb557462326ed21e7a58816c7.tar.gz
minetest-d494733839e9cf6cb557462326ed21e7a58816c7.tar.bz2
minetest-d494733839e9cf6cb557462326ed21e7a58816c7.zip
Add minetest.register_lbm() to run code on block load only
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/register.lua10
1 files changed, 9 insertions, 1 deletions
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