summaryrefslogtreecommitdiff
path: root/mesecons_insulated/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'mesecons_insulated/init.lua')
-rw-r--r--mesecons_insulated/init.lua33
1 files changed, 18 insertions, 15 deletions
diff --git a/mesecons_insulated/init.lua b/mesecons_insulated/init.lua
index 5b48716..fe929d6 100644
--- a/mesecons_insulated/init.lua
+++ b/mesecons_insulated/init.lua
@@ -21,9 +21,13 @@ minetest.register_node("mesecons_insulated:insulated_on", {
type = "fixed",
fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
},
- groups = {dig_immediate = 3, mesecon = 3, mesecon_conductor_craftable=1, not_in_creative_inventory = 1},
+ groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons_insulated:insulated_off",
-
+ mesecons = {conductor = {
+ state = mesecon.state.on,
+ offstate = "mesecons_insulated:insulated_off",
+ rules = insulated_wire_get_rules
+ }}
})
minetest.register_node("mesecons_insulated:insulated_off", {
@@ -49,7 +53,12 @@ minetest.register_node("mesecons_insulated:insulated_off", {
type = "fixed",
fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
},
- groups = {dig_immediate = 3, mesecon = 3, mesecon_conductor_craftable=1},
+ groups = {dig_immediate = 3},
+ mesecons = {conductor = {
+ state = mesecon.state.off,
+ onstate = "mesecons_insulated:insulated_on",
+ rules = insulated_wire_get_rules
+ }}
})
minetest.register_craft({
@@ -61,21 +70,15 @@ minetest.register_craft({
}
})
-mesecon:add_rules("insulated_all", { --all possible 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},})
-
mesecon:add_rules("insulated", {
{x = 1, y = 0, z = 0},
-{x =-1, y = 0, z = 0},})
+{x =-1, y = 0, z = 0}})
-function insulated_wire_get_rules(param2)
+function insulated_wire_get_rules(node)
+ local rules = {{x = 1, y = 0, z = 0},
+ {x =-1, y = 0, z = 0}}
if param2 == 1 or param2 == 3 then
- return mesecon:rotate_rules_right(mesecon:get_rules("insulated"))
+ return mesecon:rotate_rules_right(rules)
end
- return mesecon:get_rules("insulated")
+ return rules
end
-
-mesecon:register_conductor("mesecons_insulated:insulated_on", "mesecons_insulated:insulated_off", mesecon:get_rules("insulated_all"), insulated_wire_get_rules)