2015-06-29 20:55:56 +03:00
|
|
|
mesecon.rules = {}
|
|
|
|
mesecon.state = {}
|
|
|
|
|
|
|
|
mesecon.rules.default =
|
|
|
|
{{x=0, y=0, z=-1},
|
|
|
|
{x=1, y=0, z=0},
|
|
|
|
{x=-1, y=0, z=0},
|
|
|
|
{x=0, y=0, z=1},
|
2018-01-13 03:20:07 +02:00
|
|
|
{x=0, y=1, z=0},
|
|
|
|
{x=0, y=-1, z=0},
|
|
|
|
|
2015-06-29 20:55:56 +03:00
|
|
|
{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}}
|
|
|
|
|
2018-01-12 02:37:32 +02:00
|
|
|
mesecon.rules.alldirs =
|
2018-01-13 03:20:07 +02:00
|
|
|
{{x= 1, y= 0, z= 0, spread = true},
|
|
|
|
{x=-1, y= 0, z= 0, spread = true},
|
|
|
|
{x= 0, y= 1, z= 0, spread = true},
|
|
|
|
{x= 0, y=-1, z= 0, spread = true},
|
|
|
|
{x= 0, y= 0, z= 1, spread = true},
|
|
|
|
{x= 0, y= 0, z=-1, spread = true}}
|
2018-01-12 02:37:32 +02:00
|
|
|
|
|
|
|
mesecon.rules.pplate =
|
|
|
|
{{x = 1, y = 0, z = 0},
|
|
|
|
{x =-1, y = 0, z = 0},
|
|
|
|
{x = 0, y = 1, z = 0},
|
2018-01-13 03:20:07 +02:00
|
|
|
{x = 0, y =-1, z = 0, spread = true},
|
2018-01-12 02:37:32 +02:00
|
|
|
{x = 0, y = 0, z = 1},
|
2018-01-13 03:20:07 +02:00
|
|
|
{x = 0, y = 0, z =-1}}
|
2017-07-31 01:12:21 +03:00
|
|
|
|
2015-06-29 20:55:56 +03:00
|
|
|
mesecon.rules.buttonlike =
|
2018-01-13 03:20:07 +02:00
|
|
|
{{x = 0, y = 0, z =-1},
|
|
|
|
{x = 0, y = 0, z = 1},
|
|
|
|
{x = 0, y =-1, z = 0},
|
|
|
|
{x = 0, y = 1, z = 0},
|
|
|
|
{x =-1, y = 0, z = 0},
|
|
|
|
{x = 1, y = 0, z = 0, spread = true}}
|
2015-06-29 20:55:56 +03:00
|
|
|
|
|
|
|
mesecon.rules.flat =
|
|
|
|
{{x = 1, y = 0, z = 0},
|
|
|
|
{x =-1, y = 0, z = 0},
|
|
|
|
{x = 0, y = 0, z = 1},
|
2018-01-13 03:20:07 +02:00
|
|
|
{x = 0, y = 0, z =-1}}
|
|
|
|
|
|
|
|
-- NOT IN ORIGNAL MESECONS
|
|
|
|
mesecon.rules.mcl_alldirs_short =
|
|
|
|
{{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}}
|
|
|
|
|
|
|
|
-- END OF UNOFFICIAL RULES
|
2017-07-31 01:12:21 +03:00
|
|
|
|
2015-06-29 20:55:56 +03:00
|
|
|
mesecon.rules.buttonlike_get = function(node)
|
|
|
|
local rules = mesecon.rules.buttonlike
|
2017-07-31 01:12:21 +03:00
|
|
|
local dir = minetest.facedir_to_dir(node.param2)
|
|
|
|
if dir.x == 1 then
|
|
|
|
-- No action needed
|
|
|
|
elseif dir.z == -1 then
|
|
|
|
rules=mesecon.rotate_rules_left(rules)
|
|
|
|
elseif dir.x == -1 then
|
|
|
|
rules=mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules))
|
|
|
|
elseif dir.z == 1 then
|
|
|
|
rules=mesecon.rotate_rules_right(rules)
|
|
|
|
elseif dir.y == -1 then
|
|
|
|
rules=mesecon.rotate_rules_up(rules)
|
|
|
|
elseif dir.y == 1 then
|
|
|
|
rules=mesecon.rotate_rules_down(rules)
|
2015-06-29 20:55:56 +03:00
|
|
|
end
|
|
|
|
return rules
|
|
|
|
end
|
|
|
|
|
|
|
|
mesecon.state.on = "on"
|
|
|
|
mesecon.state.off = "off"
|