From 11ae41f1192d798d713a34c437cd667711241ae3 Mon Sep 17 00:00:00 2001 From: Jeija Date: Thu, 21 Jun 2012 17:27:29 +0200 Subject: [PATCH] Tune Buttons to work together with Door --- mesecons_button/init.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mesecons_button/init.lua b/mesecons_button/init.lua index 7d7ec93..0096df3 100644 --- a/mesecons_button/init.lua +++ b/mesecons_button/init.lua @@ -52,20 +52,20 @@ end) mesecon.button_turnoff = function (params) if minetest.env:get_node(params.pos).name=="mesecons_button:button_on" then minetest.env:add_node(params.pos, {name="mesecons_button:button_off", param2=params.param2}) - local rules=mesecon.button_get_rules(param2) + local rules=mesecon.button_get_rules(params.param2) mesecon:receptor_off(params.pos, rules) end end mesecon.button_get_rules = function(param2) local rules=mesecon:get_rules("button") - if param2 == 5 then + if param2 == 2 then rules=mesecon:rotate_rules_left(rules) end if param2 == 3 then rules=mesecon:rotate_rules_right(mesecon:rotate_rules_right(rules)) end - if param2 == 4 then + if param2 == 0 then rules=mesecon:rotate_rules_right(rules) end return rules @@ -92,7 +92,9 @@ mesecon:add_rules("button", { {x=0, y=0, z=-1}, {x=0, y=-1, z=-1}, {x=0, y=-1, z=0}, -{x=2, y=0, z=0}}) +{x=2, y=0, z=0}, +{x=1, y=-1, z=1}, +{x=1, y=-1, z=-1}}) mesecon:add_receptor_node_off("mesecons_button:button_off", nil, mesecon.button_get_rules) mesecon:add_receptor_node("mesecons_button:button_on", nil, mesecon.button_get_rules)