Tune Buttons to work together with Door

This commit is contained in:
Jeija 2012-06-21 17:27:29 +02:00
parent 7d944d5a33
commit 11ae41f119

View File

@ -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)