diff options
-rw-r--r-- | mesecons_extrawires/corner.lua | 83 | ||||
-rw-r--r-- | mesecons_extrawires/init.lua | 1 | ||||
-rw-r--r-- | mesecons_extrawires/tjunction.lua | 15 | ||||
-rw-r--r-- | mesecons_insulated/init.lua | 2 |
4 files changed, 91 insertions, 10 deletions
diff --git a/mesecons_extrawires/corner.lua b/mesecons_extrawires/corner.lua new file mode 100644 index 0000000..885a1ca --- /dev/null +++ b/mesecons_extrawires/corner.lua @@ -0,0 +1,83 @@ +local corner_nodebox = { + type = "fixed", + fixed = {{ -16/32-0.001, -17/32, -3/32, 0, -13/32, 3/32 }, + { -3/32, -17/32, -16/32+0.001, 3/32, -13/32, 3/32}} +} + +local corner_selectionbox = { + type = "fixed", + fixed = { -16/32-0.001, -18/32, -16/32, 5/32, -12/32, 5/32 }, +} + +local corner_get_rules = function (node) + local rules = + {{x = 1, y = 0, z = 0}, + {x = 0, y = 0, z = -1}} + + for i = 0, node.param2 do + rules = mesecon:rotate_rules_left(rules) + end + + return rules +end + +minetest.register_node("mesecons_extrawires:corner_on", { + drawtype = "nodebox", + tiles = { + "jeija_insulated_wire_sides_on.png", + "jeija_insulated_wire_sides_on.png", + "jeija_insulated_wire_ends_on.png", + "jeija_insulated_wire_ends_on.png", + "jeija_insulated_wire_sides_on.png", + "jeija_insulated_wire_ends_on.png" + }, + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + sunlight_propagates = true, + selection_box = corner_selectionbox, + node_box = corner_nodebox, + groups = {dig_immediate = 3, not_in_creative_inventory = 1}, + drop = "mesecons_extrawires:insulated_off", + mesecons = {conductor = + { + state = mesecon.state.on, + rules = corner_get_rules, + offstate = "mesecons_extrawires:corner_off" + }} +}) + +minetest.register_node("mesecons_extrawires:corner_off", { + drawtype = "nodebox", + description = "Mesecon Corner", + tiles = { + "jeija_insulated_wire_sides_off.png", + "jeija_insulated_wire_sides_off.png", + "jeija_insulated_wire_ends_off.png", + "jeija_insulated_wire_ends_off.png", + "jeija_insulated_wire_sides_off.png", + "jeija_insulated_wire_ends_off.png" + }, + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + sunlight_propagates = true, + selection_box = corner_selectionbox, + node_box = corner_nodebox, + groups = {dig_immediate = 3}, + mesecons = {conductor = + { + state = mesecon.state.off, + rules = corner_get_rules, + onstate = "mesecons_extrawires:corner_on" + }} +}) + +minetest.register_craft({ + output = '"mesecons_extrawires:corner_off" 3', + recipe = { + {"", "", ""}, + {"mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off", ""}, + {"", "mesecons_insulated:insulated_off", ""}, + } +}) diff --git a/mesecons_extrawires/init.lua b/mesecons_extrawires/init.lua index 31dfcd2..ec51a93 100644 --- a/mesecons_extrawires/init.lua +++ b/mesecons_extrawires/init.lua @@ -1,4 +1,5 @@ -- dofile(minetest.get_modpath("mesecons_extrawires").."/crossing.lua"); -- The crossing code is not active right now because it is hard to maintain dofile(minetest.get_modpath("mesecons_extrawires").."/tjunction.lua"); +dofile(minetest.get_modpath("mesecons_extrawires").."/corner.lua"); dofile(minetest.get_modpath("mesecons_extrawires").."/vertical.lua"); diff --git a/mesecons_extrawires/tjunction.lua b/mesecons_extrawires/tjunction.lua index aa100f5..9188b5b 100644 --- a/mesecons_extrawires/tjunction.lua +++ b/mesecons_extrawires/tjunction.lua @@ -11,17 +11,14 @@ local tjunction_selectionbox = { local tjunction_get_rules = function (node) local 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}, + {x = 1, y = 0, z = 0}, + {x = 0, y = 0, z = -1}} - if node.param2 == 1 then + for i = 0, node.param2 do rules = mesecon:rotate_rules_left(rules) - elseif node.param2 == 2 then - rules = mesecon:rotate_rules_right(mesecon:rotate_rules_right(rules)) - elseif node.param2 == 3 then - rules = mesecon:rotate_rules_right(rules) end + return rules end @@ -42,7 +39,7 @@ minetest.register_node("mesecons_extrawires:tjunction_on", { selection_box = tjunction_selectionbox, node_box = tjunction_nodebox, groups = {dig_immediate = 3, mesecon_conductor_craftable=1, not_in_creative_inventory = 1}, - drop = "mesecons_insulated:insulated_off", + drop = "mesecons_extrawires:tjunction_off", mesecons = {conductor = { state = mesecon.state.on, diff --git a/mesecons_insulated/init.lua b/mesecons_insulated/init.lua index 37f64c8..77bfd24 100644 --- a/mesecons_insulated/init.lua +++ b/mesecons_insulated/init.lua @@ -9,7 +9,7 @@ end minetest.register_node("mesecons_insulated:insulated_on", { drawtype = "nodebox", - description = "insulated mesecons", + description = "Insulated Mesecon", tiles = { "jeija_insulated_wire_sides_on.png", "jeija_insulated_wire_sides_on.png", |