Rework core rules of most redstone components
[MineClone/MineClone2.git] / mods / ITEMS / REDSTONE / mesecons / presets.lua
blob3d65cfe74cab38638132861688f4e93d5b125376
1 mesecon.rules = {}
2 mesecon.state = {}
4 mesecon.rules.default =
5 {{x=0, y=0, z=-1},
6 {x=1, y=0, z=0},
7 {x=-1, y=0, z=0},
8 {x=0, y=0, z=1},
9 {x=0, y=1, z=0},
10 {x=0, y=-1, z=0},
12 {x=1, y=1, z=0},
13 {x=1, y=-1, z=0},
14 {x=-1, y=1, z=0},
15 {x=-1, y=-1, z=0},
16 {x=0, y=1, z=1},
17 {x=0, y=-1, z=1},
18 {x=0, y=1, z=-1},
19 {x=0, y=-1, z=-1}}
21 mesecon.rules.alldirs =
22 {{x= 1, y= 0, z= 0},
23 {x=-1, y= 0, z= 0},
24 {x= 0, y= 1, z= 0},
25 {x= 0, y=-1, z= 0},
26 {x= 0, y= 0, z= 1},
27 {x= 0, y= 0, z=-1}}
29 mesecon.rules.pplate =
30 {{x = 1, y = 0, z = 0},
31 {x =-1, y = 0, z = 0},
32 {x = 0, y = 1, z = 0},
33 {x = 0, y =-1, z = 0, spread = true},
34 {x = 0, y = 0, z = 1},
35 {x = 0, y = 0, z =-1}}
37 mesecon.rules.buttonlike =
38 {{x = 0, y = 0, z =-1},
39 {x = 0, y = 0, z = 1},
40 {x = 0, y =-1, z = 0},
41 {x = 0, y = 1, z = 0},
42 {x =-1, y = 0, z = 0},
43 {x = 1, y = 0, z = 0, spread = true}}
45 mesecon.rules.flat =
46 {{x = 1, y = 0, z = 0},
47 {x =-1, y = 0, z = 0},
48 {x = 0, y = 0, z = 1},
49 {x = 0, y = 0, z =-1}}
51 -- NOT IN ORIGNAL MESECONS
52 mesecon.rules.mcl_alldirs_spread =
53 {{x= 1, y= 0, z= 0, spread = true},
54 {x=-1, y= 0, z= 0, spread = true},
55 {x= 0, y= 1, z= 0, spread = true},
56 {x= 0, y=-1, z= 0, spread = true},
57 {x= 0, y= 0, z= 1, spread = true},
58 {x= 0, y= 0, z=-1, spread = true}}
60 -- END OF UNOFFICIAL RULES
62 mesecon.rules.buttonlike_get = function(node)
63 local rules = mesecon.rules.buttonlike
64 local dir = minetest.facedir_to_dir(node.param2)
65 if dir.x == 1 then
66 -- No action needed
67 elseif dir.z == -1 then
68 rules=mesecon.rotate_rules_left(rules)
69 elseif dir.x == -1 then
70 rules=mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules))
71 elseif dir.z == 1 then
72 rules=mesecon.rotate_rules_right(rules)
73 elseif dir.y == -1 then
74 rules=mesecon.rotate_rules_up(rules)
75 elseif dir.y == 1 then
76 rules=mesecon.rotate_rules_down(rules)
77 end
78 return rules
79 end
81 mesecon.state.on = "on"
82 mesecon.state.off = "off"