Adjust redstone rules of most redstone components

This commit is contained in:
Wuzzy 2017-09-14 02:20:47 +02:00
parent a4b229e565
commit a34405b17b
8 changed files with 28 additions and 51 deletions

View file

@ -2,31 +2,9 @@
-- A button that when pressed emits power for 1 second
-- and then turns off again
-- FIXME: Power lower/upper nodes as well
-- FIXME: Power node behind as well
local button_get_output_rules = function(node)
local rules = {
{x = -1, y = 0, z = 0},
{x = 1, y = 0, z = 0},
{x = 0, y = 0, z = -1},
{x = 0, y = 0, z = 1},
{x = 0, y = -1, z = 0},
{x = 0, y = 1, z = 0},
}
if minetest.wallmounted_to_dir(node.param2).y == 1 then
table.insert(rules, {x=0, y=2, z=0})
elseif minetest.wallmounted_to_dir(node.param2).y == -1 then
table.insert(rules, {x=0, y=-2, z=0})
end
if minetest.wallmounted_to_dir(node.param2).x == 1 then
table.insert(rules, {x=2, y=0, z=0})
elseif minetest.wallmounted_to_dir(node.param2).x == -1 then
table.insert(rules, {x=-2, y=0, z=0})
end
if minetest.wallmounted_to_dir(node.param2).z == 1 then
table.insert(rules, {x=0, y=0, z=2})
elseif minetest.wallmounted_to_dir(node.param2).z == -1 then
table.insert(rules, {x=-0, y=0, z=-2})
end
local rules = mesecon.rules.alldirs
return rules
end