Doors: Use LBM instead of ABM to convert doors.
authorAuke Kok <sofar@foo-projects.org>
Sat, 16 Apr 2016 03:55:56 +0000 (20:55 -0700)
committerparamat <mat.gregory@virginmedia.com>
Tue, 19 Apr 2016 01:57:54 +0000 (02:57 +0100)
This works much more efficiently to replace old style doors.

mods/doors/init.lua

index 9e0999394372266ca21fd97d17bcfa73682531f5..90ddcc3d4bfe12c1bef1c76c6accd9034e4307a6 100644 (file)
@@ -203,11 +203,10 @@ function doors.register(name, def)
        end
 
        -- replace old doors of this type automatically
-       minetest.register_abm({
+       minetest.register_lbm({
+               name = ":doors:replace_" .. name:gsub(":", "_"),
                nodenames = {name.."_b_1", name.."_b_2"},
-               interval = 7.0,
-               chance = 1,
-               action = function(pos, node, active_object_count, active_object_count_wider)
+               action = function(pos, node)
                        local l = tonumber(node.name:sub(-1))
                        local meta = minetest.get_meta(pos)
                        local h = meta:get_int("right") + 1