summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2012-04-02 08:24:48 +0200
committersfan5 <sfan5@live.de>2012-04-02 08:24:48 +0200
commit3aa025b6ddb48a23d1d14edee944de2aee50ae0d (patch)
tree8c5d0760b692ac5704c27744509a29b756b3586b
parentcdb6e9b6d7c3aa99dab7eef30b9401064f35a6bb (diff)
downloadmesecons-3aa025b6ddb48a23d1d14edee944de2aee50ae0d.tar
mesecons-3aa025b6ddb48a23d1d14edee944de2aee50ae0d.tar.gz
mesecons-3aa025b6ddb48a23d1d14edee944de2aee50ae0d.tar.bz2
mesecons-3aa025b6ddb48a23d1d14edee944de2aee50ae0d.tar.xz
mesecons-3aa025b6ddb48a23d1d14edee944de2aee50ae0d.zip
Fix Wall-Lever for new Rules-System
-rw-r--r--mesecons_walllever/depends.txt1
-rw-r--r--mesecons_walllever/init.lua36
2 files changed, 6 insertions, 31 deletions
diff --git a/mesecons_walllever/depends.txt b/mesecons_walllever/depends.txt
index acaa924..52a18df 100644
--- a/mesecons_walllever/depends.txt
+++ b/mesecons_walllever/depends.txt
@@ -1 +1,2 @@
mesecons
+mesecons_button
diff --git a/mesecons_walllever/init.lua b/mesecons_walllever/init.lua
index 0276aeb..4e3401e 100644
--- a/mesecons_walllever/init.lua
+++ b/mesecons_walllever/init.lua
@@ -33,44 +33,18 @@ minetest.register_node("mesecons_walllever:wall_lever_on", {
minetest.register_on_dignode(
function(pos, oldnode, digger)
if oldnode.name == "mesecons_walllever:wall_lever_on" then
- mesecon:receptor_off(pos)
+ mesecon:receptor_off(pos, mesecon.button_get_rules(oldnode.param2))
end
end
)
minetest.register_on_punchnode(function(pos, node, puncher)
if node.name == "mesecons_walllever:wall_lever_off" then
minetest.env:add_node(pos, {name="mesecons_walllever:wall_lever_on",param2=node.param2})
- local rules_string=nil
- if node.param2 == 5 then
- rules_string="button_z+"
- end
- if node.param2 == 3 then
- rules_string="button_x+"
- end
- if node.param2 == 4 then
- rules_string="button_z-"
- end
- if node.param2 == 2 then
- rules_string="button_x-"
- end
- mesecon:receptor_on(pos, rules_string)
+ mesecon:receptor_on(pos, mesecon.button_get_rules(node.param2))
end
if node.name == "mesecons_walllever:wall_lever_on" then
minetest.env:add_node(pos, {name="mesecons_walllever:wall_lever_off",param2=node.param2})
- local rules_string=nil
- if node.param2 == 5 then
- rules_string="button_z+"
- end
- if node.param2 == 3 then
- rules_string="button_x+"
- end
- if node.param2 == 4 then
- rules_string="button_z-"
- end
- if node.param2 == 2 then
- rules_string="button_x-"
- end
- mesecon:receptor_off(pos, rules_string)
+ mesecon:receptor_off(pos, mesecon.button_get_rules(node.param2))
end
end)
@@ -82,5 +56,5 @@ minetest.register_craft({
{'"default:stick"'},
}
})
-mesecon:add_receptor_node("mesecons_walllever:wall_lever")
-mesecon:add_receptor_node_off("mesecons_walllever:wall_lever_off")
+mesecon:add_receptor_node("mesecons_walllever:wall_lever", nil, mesecon.button_get_rules)
+mesecon:add_receptor_node_off("mesecons_walllever:wall_lever_off", nil, mesecon.button_get_rules)