From 885899cbaf6ccb2d22a3495131204ea0d01131ed Mon Sep 17 00:00:00 2001 From: khonkhortisan Date: Wed, 19 Jun 2013 19:38:34 -0700 Subject: Crossover --- mesecons_extrawires/crossing.lua | 49 ------------- mesecons_extrawires/crossover.lua | 151 ++++++++++++++++++++++++++++++++++++++ mesecons_extrawires/init.lua | 3 +- 3 files changed, 152 insertions(+), 51 deletions(-) delete mode 100644 mesecons_extrawires/crossing.lua create mode 100644 mesecons_extrawires/crossover.lua (limited to 'mesecons_extrawires') diff --git a/mesecons_extrawires/crossing.lua b/mesecons_extrawires/crossing.lua deleted file mode 100644 index 9b381bf..0000000 --- a/mesecons_extrawires/crossing.lua +++ /dev/null @@ -1,49 +0,0 @@ --- CODE NOT ACTIVE - -local crossing_get_rules = function(node) - --TODO: calculate the real port states and use rules to link to them only if -end - -minetest.register_node("mesecons_extrawires:crossing_on", { - drawtype = "nodebox", - tiles = {"jeija_insulated_wire_sides_on.png"}, - paramtype = "light", - walkable = false, - stack_max = 99, - selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}}, - node_box = { - type = "fixed", - fixed = { - { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }, - { -3/32, -17/32, -16/32-0.001, 3/32, -13/32, -6/32 }, - { -3/32, -13/32, -9/32, 3/32, -6/32, -6/32 }, - { -3/32, -9/32, -9/32, 3/32, -6/32, 9/32 }, - { -3/32, -13/32, 6/32, 3/32, -6/32, 9/32 }, - { -3/32, -17/32, 6/32, 3/32, -13/32, 16/32+0.001 }, - }, - }, - groups = {dig_immediate=3, mesecon=3, mesecon_conductor_craftable=1, not_in_creative_inventory=1}, - mesecons = { - receptor = { - state = mesecon.state.on, - rules = crossing_get_rules, - } - }, -}) - -minetest.register_craft({ - type = "shapeless", - output = "mesecons_extrawires:crossing", - recipe = { - "mesecons_insulated:insulated_off", - "mesecons_insulated:insulated_off", - }, -}) - -minetest.register_craft({ - type = "shapeless", - output = "mesecons_insulated:insulated_off 2", - recipe = { - "mesecons_extrawires:crossing", - }, -}) diff --git a/mesecons_extrawires/crossover.lua b/mesecons_extrawires/crossover.lua new file mode 100644 index 0000000..b150e03 --- /dev/null +++ b/mesecons_extrawires/crossover.lua @@ -0,0 +1,151 @@ +function crossover_get_rules(node) + return { + {--first wire + {x=-1,y=0,z=0}, + {x=1,y=0,z=0}, + }, + {--second wire + {x=0,y=0,z=-1}, + {x=0,y=0,z=1}, + }, + } +end + +local crossover_states = { + "mesecons_extrawires:crossover_off", + "mesecons_extrawires:crossover_01", + "mesecons_extrawires:crossover_10", + "mesecons_extrawires:crossover_on", +} + +minetest.register_node("mesecons_extrawires:crossover_off", { + description = "Insulated Crossover", + drawtype = "nodebox", + tiles = {"jeija_insulated_wire_sides_off.png"}, + paramtype = "light", + walkable = false, + stack_max = 99, + selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}}, + node_box = { + type = "fixed", + fixed = { + { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }, + { -3/32, -17/32, -16/32-0.001, 3/32, -13/32, -6/32 }, + { -3/32, -13/32, -9/32, 3/32, -6/32, -6/32 }, + { -3/32, -9/32, -9/32, 3/32, -6/32, 9/32 }, + { -3/32, -13/32, 6/32, 3/32, -6/32, 9/32 }, + { -3/32, -17/32, 6/32, 3/32, -13/32, 16/32+0.001 }, + }, + }, + groups = {dig_immediate=3, mesecon=3, mesecon_conductor_craftable=1}, + mesecons = { + conductor = { + states = crossover_states, + rules = crossover_get_rules(), + } + }, +}) + +minetest.register_node("mesecons_extrawires:crossover_01", { + description = "You hacker you!", + drop = "mesecons_extrawires:crossover_off", + drawtype = "nodebox", + tiles = {"default_dirt.png"}, + paramtype = "light", + walkable = false, + stack_max = 99, + selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}}, + node_box = { + type = "fixed", + fixed = { + { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }, + { -3/32, -17/32, -16/32-0.001, 3/32, -13/32, -6/32 }, + { -3/32, -13/32, -9/32, 3/32, -6/32, -6/32 }, + { -3/32, -9/32, -9/32, 3/32, -6/32, 9/32 }, + { -3/32, -13/32, 6/32, 3/32, -6/32, 9/32 }, + { -3/32, -17/32, 6/32, 3/32, -13/32, 16/32+0.001 }, + }, + }, + groups = {dig_immediate=3, mesecon=3, mesecon_conductor_craftable=1, not_in_creative_inventory=1}, + mesecons = { + conductor = { + states = crossover_states, + rules = crossover_get_rules(), + } + }, +}) + +minetest.register_node("mesecons_extrawires:crossover_10", { + description = "You hacker you!", + drop = "mesecons_extrawires:crossover_off", + drawtype = "nodebox", + tiles = {"default_stone.png"}, + paramtype = "light", + walkable = false, + stack_max = 99, + selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}}, + node_box = { + type = "fixed", + fixed = { + { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }, + { -3/32, -17/32, -16/32-0.001, 3/32, -13/32, -6/32 }, + { -3/32, -13/32, -9/32, 3/32, -6/32, -6/32 }, + { -3/32, -9/32, -9/32, 3/32, -6/32, 9/32 }, + { -3/32, -13/32, 6/32, 3/32, -6/32, 9/32 }, + { -3/32, -17/32, 6/32, 3/32, -13/32, 16/32+0.001 }, + }, + }, + groups = {dig_immediate=3, mesecon=3, mesecon_conductor_craftable=1, not_in_creative_inventory=1}, + mesecons = { + conductor = { + states = crossover_states, + rules = crossover_get_rules(), + } + }, +}) + +minetest.register_node("mesecons_extrawires:crossover_on", { + description = "You hacker you!", + drop = "mesecons_extrawires:crossover_off", + drawtype = "nodebox", + tiles = {"jeija_insulated_wire_sides_on.png"}, + paramtype = "light", + walkable = false, + stack_max = 99, + selection_box = {type="fixed", fixed={-16/32-0.0001, -18/32, -16/32-0.001, 16/32+0.001, -5/32, 16/32+0.001}}, + node_box = { + type = "fixed", + fixed = { + { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }, + { -3/32, -17/32, -16/32-0.001, 3/32, -13/32, -6/32 }, + { -3/32, -13/32, -9/32, 3/32, -6/32, -6/32 }, + { -3/32, -9/32, -9/32, 3/32, -6/32, 9/32 }, + { -3/32, -13/32, 6/32, 3/32, -6/32, 9/32 }, + { -3/32, -17/32, 6/32, 3/32, -13/32, 16/32+0.001 }, + }, + }, + groups = {dig_immediate=3, mesecon=3, mesecon_conductor_craftable=1, not_in_creative_inventory=1}, + mesecons = { + conductor = { + states = crossover_states, + rules = crossover_get_rules(), + } + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "mesecons_extrawires:crossover_off", + recipe = { + "mesecons_insulated:insulated_off", + "mesecons_insulated:insulated_off", + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "mesecons_insulated:insulated_off 2", + recipe = { + "mesecons_extrawires:crossover_off", + }, +}) diff --git a/mesecons_extrawires/init.lua b/mesecons_extrawires/init.lua index c076e3d..b22f2e5 100644 --- a/mesecons_extrawires/init.lua +++ b/mesecons_extrawires/init.lua @@ -1,5 +1,4 @@ --- 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").."/crossover.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"); -- cgit v1.2.3