Add experimental 'corner' wire, an insulated bended wire (needs textures and maybe rename it)

This commit is contained in:
Jeija 2012-12-27 09:54:19 +01:00
parent 7fe4947056
commit d1ace465c7
4 changed files with 91 additions and 10 deletions

@ -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", ""},
}
})

@ -1,4 +1,5 @@
-- dofile(minetest.get_modpath("mesecons_extrawires").."/crossing.lua"); -- dofile(minetest.get_modpath("mesecons_extrawires").."/crossing.lua");
-- The crossing code is not active right now because it is hard to maintain -- 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").."/tjunction.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/corner.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/vertical.lua"); dofile(minetest.get_modpath("mesecons_extrawires").."/vertical.lua");

@ -11,17 +11,14 @@ local tjunction_selectionbox = {
local tjunction_get_rules = function (node) local tjunction_get_rules = function (node)
local rules = local rules =
{{x = 1, y = 0, z = 0}, {{x = 0, y = 0, z = 1},
{x =-1, y = 0, z = 0}, {x = 1, y = 0, z = 0},
{x = 0, y = 0, z = -1}} {x = 0, y = 0, z = -1}}
if node.param2 == 1 then for i = 0, node.param2 do
rules = mesecon:rotate_rules_left(rules) 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 end
return rules return rules
end end
@ -42,7 +39,7 @@ minetest.register_node("mesecons_extrawires:tjunction_on", {
selection_box = tjunction_selectionbox, selection_box = tjunction_selectionbox,
node_box = tjunction_nodebox, node_box = tjunction_nodebox,
groups = {dig_immediate = 3, mesecon_conductor_craftable=1, not_in_creative_inventory = 1}, 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 = mesecons = {conductor =
{ {
state = mesecon.state.on, state = mesecon.state.on,

@ -9,7 +9,7 @@ end
minetest.register_node("mesecons_insulated:insulated_on", { minetest.register_node("mesecons_insulated:insulated_on", {
drawtype = "nodebox", drawtype = "nodebox",
description = "insulated mesecons", description = "Insulated Mesecon",
tiles = { tiles = {
"jeija_insulated_wire_sides_on.png", "jeija_insulated_wire_sides_on.png",
"jeija_insulated_wire_sides_on.png", "jeija_insulated_wire_sides_on.png",