2012-12-09 13:28:32 +01:00
|
|
|
mesecon.rules = {}
|
2012-12-08 14:14:04 +01:00
|
|
|
mesecon.state = {}
|
|
|
|
|
2012-12-08 21:56:09 +01:00
|
|
|
mesecon.rules.default =
|
2012-12-08 14:14:04 +01:00
|
|
|
{{x=0, y=0, z=-1},
|
2012-12-13 18:42:45 +01:00
|
|
|
{x=1, y=0, z=0},
|
|
|
|
{x=-1, y=0, z=0},
|
|
|
|
{x=0, y=0, z=1},
|
|
|
|
{x=1, y=1, z=0},
|
|
|
|
{x=1, y=-1, z=0},
|
|
|
|
{x=-1, y=1, z=0},
|
|
|
|
{x=-1, y=-1, z=0},
|
|
|
|
{x=0, y=1, z=1},
|
|
|
|
{x=0, y=-1, z=1},
|
|
|
|
{x=0, y=1, z=-1},
|
|
|
|
{x=0, y=-1, z=-1}}
|
2012-12-08 14:14:04 +01:00
|
|
|
|
2014-11-22 17:12:48 +01:00
|
|
|
mesecon.rules.pplate = mesecon.mergetable(mesecon.rules.default, {{x=0, y=-2, z=0}})
|
2014-11-22 12:28:45 +01:00
|
|
|
|
2012-12-08 21:56:09 +01:00
|
|
|
mesecon.rules.buttonlike =
|
|
|
|
{{x = 1, y = 0, z = 0},
|
2012-12-13 18:42:45 +01:00
|
|
|
{x = 1, y = 1, z = 0},
|
|
|
|
{x = 1, y =-1, z = 0},
|
2015-10-04 13:30:34 +02:00
|
|
|
{x = 1, y =-1, z = 1},
|
2012-12-13 18:42:45 +01:00
|
|
|
{x = 1, y =-1, z =-1},
|
|
|
|
{x = 2, y = 0, z = 0}}
|
2012-12-08 21:56:09 +01:00
|
|
|
|
2012-12-13 18:42:45 +01:00
|
|
|
mesecon.rules.flat =
|
|
|
|
{{x = 1, y = 0, z = 0},
|
|
|
|
{x =-1, y = 0, z = 0},
|
|
|
|
{x = 0, y = 0, z = 1},
|
|
|
|
{x = 0, y = 0, z =-1}}
|
2015-02-28 13:42:39 +01:00
|
|
|
|
|
|
|
mesecon.rules.alldirs =
|
|
|
|
{{x= 1, y= 0, z= 0},
|
|
|
|
{x=-1, y= 0, z= 0},
|
|
|
|
{x= 0, y= 1, z= 0},
|
|
|
|
{x= 0, y=-1, z= 0},
|
|
|
|
{x= 0, y= 0, z= 1},
|
|
|
|
{x= 0, y= 0, z=-1}}
|
2015-10-04 13:30:34 +02:00
|
|
|
|
2012-12-09 13:28:32 +01:00
|
|
|
mesecon.rules.buttonlike_get = function(node)
|
|
|
|
local rules = mesecon.rules.buttonlike
|
2016-12-25 23:50:09 -06:00
|
|
|
local dir = minetest.facedir_to_dir(node.param2)
|
|
|
|
if dir.x == 1 then
|
|
|
|
-- No action needed
|
|
|
|
elseif dir.z == -1 then
|
2014-11-22 15:42:22 +01:00
|
|
|
rules=mesecon.rotate_rules_left(rules)
|
2016-12-25 23:50:09 -06:00
|
|
|
elseif dir.x == -1 then
|
2014-11-22 15:42:22 +01:00
|
|
|
rules=mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules))
|
2016-12-25 23:50:09 -06:00
|
|
|
elseif dir.z == 1 then
|
2014-11-22 15:42:22 +01:00
|
|
|
rules=mesecon.rotate_rules_right(rules)
|
2016-12-25 23:50:09 -06:00
|
|
|
elseif dir.y == -1 then
|
|
|
|
rules=mesecon.rotate_rules_up(rules)
|
|
|
|
elseif dir.y == 1 then
|
|
|
|
rules=mesecon.rotate_rules_down(rules)
|
2012-12-09 13:28:32 +01:00
|
|
|
end
|
|
|
|
return rules
|
|
|
|
end
|
|
|
|
|
2012-12-08 14:14:04 +01:00
|
|
|
mesecon.state.on = "on"
|
|
|
|
mesecon.state.off = "off"
|