]> git.lizzy.rs Git - xdecor.git/commitdiff
Add mesecons support to doors (#106)
authorbenrob0329 <ben@innovationplex.com>
Sun, 9 Jun 2019 18:50:10 +0000 (14:50 -0400)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Sun, 9 Jun 2019 18:50:10 +0000 (20:50 +0200)
(if available)

depends.txt
src/nodes.lua

index 49669a275e87a7ab30471c3dfda4adbce053fc9d..5ea4cb6e4430a5be3142a7c413fbc160a0793111 100644 (file)
@@ -5,4 +5,5 @@ stairs
 xpanes
 fire?
 oresplus?
-moreblocks?
\ No newline at end of file
+moreblocks?
+mesecons_doors?
index 20bd72e8af6d3fee9f9541dfedbc04c458c9dd35..969a8038338031bf2c3c5a531ef878e4c4576b4f 100644 (file)
@@ -263,6 +263,25 @@ local xdecor_doors = {
                {"group:wood", "group:wood"} }
 }
 
+local mesecons_register
+if minetest.global_exists("mesecon") then
+       mesecons_register = { effector = {
+               action_on = function(pos, node)
+                       local door = doors.get(pos)
+                       if door then
+                               door:open()
+                       end
+               end,
+               action_off = function(pos, node)
+                       local door = doors.get(pos)
+                       if door then
+                               door:close()
+                       end
+               end,
+               rules = mesecon.rules.pplate
+       }}
+end
+
 for name, recipe in pairs(xdecor_doors) do
        if not doors.register then break end
        doors.register(name.."_door", {
@@ -271,7 +290,8 @@ for name, recipe in pairs(xdecor_doors) do
                inventory_image = "xdecor_"..name.."_door_inv.png",
                protected = door_access(name),
                groups = {choppy=2, cracky=2, oddly_breakable_by_hand=1, door=1},
-               recipe = recipe
+               recipe = recipe,
+               mesecons = mesecons_register
        })
 end