diff options
author | Jeija <norrepli@gmail.com> | 2012-12-08 22:28:46 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2012-12-08 22:28:46 +0100 |
commit | cf6080f7237af1c55a6d80bea4725dcb5c8cb1eb (patch) | |
tree | 6e858459204230ad5cc0ea2c39c10a161a738d5e /mesecons_insulated/init.lua | |
parent | 00e071b695574928fce2ca56e3e8eca6ad3d35ef (diff) |
Port more blocks to nodedef system: object detector, extrawires, water turbine, insulated wire
Diffstat (limited to 'mesecons_insulated/init.lua')
-rw-r--r-- | mesecons_insulated/init.lua | 33 |
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) |