Open/close doors with rightclick
authorPilzAdam <PilzAdam@gmx.de>
Fri, 4 Jan 2013 16:02:46 +0000 (17:02 +0100)
committerPilzAdam <PilzAdam@gmx.de>
Sat, 5 Jan 2013 16:25:19 +0000 (17:25 +0100)
mods/doors/init.lua

index 4c0460b9cc18d9a4f02257f1335fedeca8223060..3e239f052fad1acda48755ca170ebe27e7b28046 100644 (file)
@@ -96,7 +96,7 @@ function doors:register_door(name, def)
                end
        end
        
-       local function on_punch(pos, dir, check_name, replace, replace_dir, params)
+       local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
                pos.y = pos.y+dir
                if not minetest.env:get_node(pos).name == check_name then
                        return
@@ -144,9 +144,9 @@ function doors:register_door(name, def)
                        after_dig_node(pos, name.."_t_1")
                end,
                
-               on_punch = function(pos, node, puncher)
-                       if check_player_priv(pos, puncher) then
-                               on_punch(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
+               on_rightclick = function(pos, node, clicker)
+                       if check_player_priv(pos, clicker) then
+                               on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
                        end
                end,
                
@@ -174,9 +174,9 @@ function doors:register_door(name, def)
                        after_dig_node(pos, name.."_b_1")
                end,
                
-               on_punch = function(pos, node, puncher)
-                       if check_player_priv(pos, puncher) then
-                               on_punch(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
+               on_rightclick = function(pos, node, clicker)
+                       if check_player_priv(pos, clicker) then
+                               on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
                        end
                end,
                
@@ -204,9 +204,9 @@ function doors:register_door(name, def)
                        after_dig_node(pos, name.."_t_2")
                end,
                
-               on_punch = function(pos, node, puncher)
-                       if check_player_priv(pos, puncher) then
-                               on_punch(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
+               on_rightclick = function(pos, node, clicker)
+                       if check_player_priv(pos, clicker) then
+                               on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
                        end
                end,
                
@@ -234,9 +234,9 @@ function doors:register_door(name, def)
                        after_dig_node(pos, name.."_b_2")
                end,
                
-               on_punch = function(pos, node, puncher)
-                       if check_player_priv(pos, puncher) then
-                               on_punch(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
+               on_rightclick = function(pos, node, clicker)
+                       if check_player_priv(pos, clicker) then
+                               on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
                        end
                end,