summaryrefslogtreecommitdiff
path: root/mesecons_extrawires
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-04-01 21:00:20 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-04-01 21:10:04 -0400
commit888b0ebfec8c2eff9015163549a7e47443cb8665 (patch)
tree915080159bfaa6ba6e226087c7ce0e8d5464b518 /mesecons_extrawires
parentda66780a569712c23ae4f2996cfb4608a9f9d69d (diff)
downloaddreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar
dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.gz
dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.bz2
dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.xz
dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.zip
"explode" all modpacks into their individual components
(you can't have a modpack buried inside a modpack)
Diffstat (limited to 'mesecons_extrawires')
-rw-r--r--mesecons_extrawires/corner.lua83
-rw-r--r--mesecons_extrawires/crossover.lua176
-rw-r--r--mesecons_extrawires/depends.txt2
-rw-r--r--mesecons_extrawires/doc/corner/description.html1
-rw-r--r--mesecons_extrawires/doc/corner/preview.pngbin0 -> 41643 bytes
-rw-r--r--mesecons_extrawires/doc/corner/recipe.pngbin0 -> 3902 bytes
-rw-r--r--mesecons_extrawires/doc/crossing/description.html1
-rw-r--r--mesecons_extrawires/doc/crossing/preview.pngbin0 -> 62464 bytes
-rw-r--r--mesecons_extrawires/doc/crossing/recipe.pngbin0 -> 3745 bytes
-rw-r--r--mesecons_extrawires/doc/mese/description.html1
-rw-r--r--mesecons_extrawires/doc/mese/preview.pngbin0 -> 30599 bytes
-rw-r--r--mesecons_extrawires/doc/mese/recipe.pngbin0 -> 6266 bytes
-rw-r--r--mesecons_extrawires/doc/tjunction/description.html1
-rw-r--r--mesecons_extrawires/doc/tjunction/preview.pngbin0 -> 55089 bytes
-rw-r--r--mesecons_extrawires/doc/tjunction/recipe.pngbin0 -> 3946 bytes
-rw-r--r--mesecons_extrawires/doc/vertical/description.html1
-rw-r--r--mesecons_extrawires/doc/vertical/preview.pngbin0 -> 13816 bytes
-rw-r--r--mesecons_extrawires/doc/vertical/recipe.pngbin0 -> 3059 bytes
-rw-r--r--mesecons_extrawires/init.lua5
-rw-r--r--mesecons_extrawires/mesewire.lua30
-rw-r--r--mesecons_extrawires/tjunction.lua84
-rw-r--r--mesecons_extrawires/vertical.lua183
22 files changed, 568 insertions, 0 deletions
diff --git a/mesecons_extrawires/corner.lua b/mesecons_extrawires/corner.lua
new file mode 100644
index 0000000..1e29870
--- /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_curved_tb_on.png",
+ "jeija_insulated_wire_curved_tb_on.png^[transformR270",
+ "jeija_insulated_wire_sides_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:corner_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_curved_tb_off.png",
+ "jeija_insulated_wire_curved_tb_off.png^[transformR270",
+ "jeija_insulated_wire_sides_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/crossover.lua b/mesecons_extrawires/crossover.lua
new file mode 100644
index 0000000..4ecfc12
--- /dev/null
+++ b/mesecons_extrawires/crossover.lua
@@ -0,0 +1,176 @@
+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_crossing_tb_off.png",
+ "jeija_insulated_wire_crossing_tb_off.png",
+ "jeija_insulated_wire_ends_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},
+ 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 = {
+ "jeija_insulated_wire_crossing_tb_01.png",
+ "jeija_insulated_wire_crossing_tb_01.png",
+ "jeija_insulated_wire_ends_01x.png",
+ "jeija_insulated_wire_ends_01x.png",
+ "jeija_insulated_wire_ends_01z.png",
+ "jeija_insulated_wire_ends_01z.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, 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 = {
+ "jeija_insulated_wire_crossing_tb_10.png",
+ "jeija_insulated_wire_crossing_tb_10.png",
+ "jeija_insulated_wire_ends_10x.png",
+ "jeija_insulated_wire_ends_10x.png",
+ "jeija_insulated_wire_ends_10z.png",
+ "jeija_insulated_wire_ends_10z.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, 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_crossing_tb_on.png",
+ "jeija_insulated_wire_crossing_tb_on.png",
+ "jeija_insulated_wire_ends_on.png",
+ "jeija_insulated_wire_ends_on.png",
+ "jeija_insulated_wire_ends_on.png",
+ "jeija_insulated_wire_ends_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, 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/depends.txt b/mesecons_extrawires/depends.txt
new file mode 100644
index 0000000..aca967d
--- /dev/null
+++ b/mesecons_extrawires/depends.txt
@@ -0,0 +1,2 @@
+default
+mesecons
diff --git a/mesecons_extrawires/doc/corner/description.html b/mesecons_extrawires/doc/corner/description.html
new file mode 100644
index 0000000..92de8b0
--- /dev/null
+++ b/mesecons_extrawires/doc/corner/description.html
@@ -0,0 +1 @@
+Insulated corners are conductors that only conduct between the inputs (also not up or down). When placing they always point to the left in direction of your vision.
diff --git a/mesecons_extrawires/doc/corner/preview.png b/mesecons_extrawires/doc/corner/preview.png
new file mode 100644
index 0000000..9713229
--- /dev/null
+++ b/mesecons_extrawires/doc/corner/preview.png
Binary files differ
diff --git a/mesecons_extrawires/doc/corner/recipe.png b/mesecons_extrawires/doc/corner/recipe.png
new file mode 100644
index 0000000..ac85b01
--- /dev/null
+++ b/mesecons_extrawires/doc/corner/recipe.png
Binary files differ
diff --git a/mesecons_extrawires/doc/crossing/description.html b/mesecons_extrawires/doc/crossing/description.html
new file mode 100644
index 0000000..aa4cf25
--- /dev/null
+++ b/mesecons_extrawires/doc/crossing/description.html
@@ -0,0 +1 @@
+Insulated crossing are conductors that conduct two signals between the opposing sides, the signals are insulated to each other.
diff --git a/mesecons_extrawires/doc/crossing/preview.png b/mesecons_extrawires/doc/crossing/preview.png
new file mode 100644
index 0000000..66aaa05
--- /dev/null
+++ b/mesecons_extrawires/doc/crossing/preview.png
Binary files differ
diff --git a/mesecons_extrawires/doc/crossing/recipe.png b/mesecons_extrawires/doc/crossing/recipe.png
new file mode 100644
index 0000000..ac37401
--- /dev/null
+++ b/mesecons_extrawires/doc/crossing/recipe.png
Binary files differ
diff --git a/mesecons_extrawires/doc/mese/description.html b/mesecons_extrawires/doc/mese/description.html
new file mode 100644
index 0000000..1a14864
--- /dev/null
+++ b/mesecons_extrawires/doc/mese/description.html
@@ -0,0 +1 @@
+The basic prerequesite for mesecons, can be crafted into wires and other stuff. Have a look at the <a href="http://wiki.minetest.net/Mese">Minetest Wiki</a> for more information. Mese is a conductor. It conducts in all six directions: Up/Down/Left/Right/Forward/Backward
diff --git a/mesecons_extrawires/doc/mese/preview.png b/mesecons_extrawires/doc/mese/preview.png
new file mode 100644
index 0000000..3ce0ea4
--- /dev/null
+++ b/mesecons_extrawires/doc/mese/preview.png
Binary files differ
diff --git a/mesecons_extrawires/doc/mese/recipe.png b/mesecons_extrawires/doc/mese/recipe.png
new file mode 100644
index 0000000..904cf0b
--- /dev/null
+++ b/mesecons_extrawires/doc/mese/recipe.png
Binary files differ
diff --git a/mesecons_extrawires/doc/tjunction/description.html b/mesecons_extrawires/doc/tjunction/description.html
new file mode 100644
index 0000000..f655a5d
--- /dev/null
+++ b/mesecons_extrawires/doc/tjunction/description.html
@@ -0,0 +1 @@
+Insulated T-Junctions are conductors that only conduct between the inputs (also not up or down).
diff --git a/mesecons_extrawires/doc/tjunction/preview.png b/mesecons_extrawires/doc/tjunction/preview.png
new file mode 100644
index 0000000..4dec841
--- /dev/null
+++ b/mesecons_extrawires/doc/tjunction/preview.png
Binary files differ
diff --git a/mesecons_extrawires/doc/tjunction/recipe.png b/mesecons_extrawires/doc/tjunction/recipe.png
new file mode 100644
index 0000000..8602941
--- /dev/null
+++ b/mesecons_extrawires/doc/tjunction/recipe.png
Binary files differ
diff --git a/mesecons_extrawires/doc/vertical/description.html b/mesecons_extrawires/doc/vertical/description.html
new file mode 100644
index 0000000..df09b94
--- /dev/null
+++ b/mesecons_extrawires/doc/vertical/description.html
@@ -0,0 +1 @@
+Vertical Mesecons only conduct up and down. Plates appear at the ends, at that place they also conduct to the side.
diff --git a/mesecons_extrawires/doc/vertical/preview.png b/mesecons_extrawires/doc/vertical/preview.png
new file mode 100644
index 0000000..aad6ea8
--- /dev/null
+++ b/mesecons_extrawires/doc/vertical/preview.png
Binary files differ
diff --git a/mesecons_extrawires/doc/vertical/recipe.png b/mesecons_extrawires/doc/vertical/recipe.png
new file mode 100644
index 0000000..83bc498
--- /dev/null
+++ b/mesecons_extrawires/doc/vertical/recipe.png
Binary files differ
diff --git a/mesecons_extrawires/init.lua b/mesecons_extrawires/init.lua
new file mode 100644
index 0000000..b22f2e5
--- /dev/null
+++ b/mesecons_extrawires/init.lua
@@ -0,0 +1,5 @@
+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");
+dofile(minetest.get_modpath("mesecons_extrawires").."/mesewire.lua");
diff --git a/mesecons_extrawires/mesewire.lua b/mesecons_extrawires/mesewire.lua
new file mode 100644
index 0000000..150178c
--- /dev/null
+++ b/mesecons_extrawires/mesewire.lua
@@ -0,0 +1,30 @@
+local mesewire_rules =
+{
+ {x = 1, y = 0, z = 0},
+ {x =-1, y = 0, z = 0},
+ {x = 0, y = 1, z = 0},
+ {x = 0, y =-1, z = 0},
+ {x = 0, y = 0, z = 1},
+ {x = 0, y = 0, z =-1},
+}
+
+minetest.override_item("default:mese", {
+ mesecons = {conductor = {
+ state = mesecon.state.off,
+ onstate = "mesecons_extrawires:mese_powered",
+ rules = mesewire_rules
+ }}
+})
+
+minetest.register_node("mesecons_extrawires:mese_powered", {
+ tiles = {minetest.registered_nodes["default:mese"].tiles[1].."^[brighten"},
+ is_ground_content = true,
+ groups = {cracky=1, not_in_creative_inventory = 1},
+ sounds = default.node_sound_stone_defaults(),
+ mesecons = {conductor = {
+ state = mesecon.state.on,
+ offstate = "default:mese",
+ rules = mesewire_rules
+ }},
+ drop = "default:mese"
+})
diff --git a/mesecons_extrawires/tjunction.lua b/mesecons_extrawires/tjunction.lua
new file mode 100644
index 0000000..1091e83
--- /dev/null
+++ b/mesecons_extrawires/tjunction.lua
@@ -0,0 +1,84 @@
+local tjunction_nodebox = {
+ 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, -3/32},}
+}
+
+local tjunction_selectionbox = {
+ type = "fixed",
+ fixed = { -16/32-0.001, -18/32, -16/32, 16/32+0.001, -12/32, 7/32 },
+}
+
+local tjunction_get_rules = function (node)
+ local rules =
+ {{x = 0, y = 0, z = 1},
+ {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:tjunction_on", {
+ drawtype = "nodebox",
+ tiles = {
+ "jeija_insulated_wire_tjunction_tb_on.png",
+ "jeija_insulated_wire_tjunction_tb_on.png^[transformR180",
+ "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 = tjunction_selectionbox,
+ node_box = tjunction_nodebox,
+ groups = {dig_immediate = 3, not_in_creative_inventory = 1},
+ drop = "mesecons_extrawires:tjunction_off",
+ mesecons = {conductor =
+ {
+ state = mesecon.state.on,
+ rules = tjunction_get_rules,
+ offstate = "mesecons_extrawires:tjunction_off"
+ }}
+})
+
+minetest.register_node("mesecons_extrawires:tjunction_off", {
+ drawtype = "nodebox",
+ description = "T-junction",
+ tiles = {
+ "jeija_insulated_wire_tjunction_tb_off.png",
+ "jeija_insulated_wire_tjunction_tb_off.png^[transformR180",
+ "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 = tjunction_selectionbox,
+ node_box = tjunction_nodebox,
+ groups = {dig_immediate = 3},
+ mesecons = {conductor =
+ {
+ state = mesecon.state.off,
+ rules = tjunction_get_rules,
+ onstate = "mesecons_extrawires:tjunction_on"
+ }}
+})
+
+minetest.register_craft({
+ output = "mesecons_extrawires:tjunction_off 3",
+ recipe = {
+ {"", "", ""},
+ {"mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off"},
+ {"", "mesecons_insulated:insulated_off", ""},
+ }
+})
diff --git a/mesecons_extrawires/vertical.lua b/mesecons_extrawires/vertical.lua
new file mode 100644
index 0000000..cac2ae2
--- /dev/null
+++ b/mesecons_extrawires/vertical.lua
@@ -0,0 +1,183 @@
+local vertical_box = {
+ type = "fixed",
+ fixed = {-1/16, -8/16, -1/16, 1/16, 8/16, 1/16}
+}
+
+local top_box = {
+ type = "fixed",
+ fixed = {{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16}}
+}
+
+local bottom_box = {
+ type = "fixed",
+ fixed = {
+ {-8/16, -8/16, -8/16, 8/16, -7/16, 8/16},
+ {-1/16, -7/16, -1/16, 1/16, 8/16, 1/16},
+ }
+}
+
+local vertical_rules = {
+ {x=0, y=1, z=0},
+ {x=0, y=-1, z=0}
+}
+
+local top_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=0,y=-1, z=0}
+}
+
+local bottom_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=0, y=1, z=0},
+ {x=0, y=2, z=0} -- receive power from pressure plate / detector / ... 2 nodes above
+}
+
+local vertical_updatepos = function (pos)
+ local node = minetest.get_node(pos)
+ if minetest.registered_nodes[node.name]
+ and minetest.registered_nodes[node.name].is_vertical_conductor then
+ local node_above = minetest.get_node(mesecon.addPosRule(pos, vertical_rules[1]))
+ local node_below = minetest.get_node(mesecon.addPosRule(pos, vertical_rules[2]))
+ local namestate = minetest.registered_nodes[node.name].vertical_conductor_state
+
+ local above = minetest.registered_nodes[node_above.name]
+ and minetest.registered_nodes[node_above.name].is_vertical_conductor
+ local below = minetest.registered_nodes[node_below.name]
+ and minetest.registered_nodes[node_below.name].is_vertical_conductor
+
+ local basename = "mesecons_extrawires:vertical_"
+ if above and below then -- above and below: vertical mesecon
+ minetest.add_node(pos, {name = basename .. namestate})
+ elseif above and not below then -- above only: bottom
+ minetest.add_node(pos, {name = basename .. "bottom_" .. namestate})
+ elseif not above and below then -- below only: top
+ minetest.add_node(pos, {name = basename .. "top_" .. namestate})
+ else -- no vertical wire above, no vertical wire below: use bottom
+ minetest.add_node(pos, {name = basename .. "bottom_" .. namestate})
+ end
+ mesecon.update_autoconnect(pos)
+ end
+end
+
+local vertical_update = function (pos, node)
+ vertical_updatepos(pos) -- this one
+ vertical_updatepos(mesecon.addPosRule(pos, vertical_rules[1])) -- above
+ vertical_updatepos(mesecon.addPosRule(pos, vertical_rules[2])) -- below
+end
+
+-- Vertical wire
+mesecon.register_node("mesecons_extrawires:vertical", {
+ description = "Vertical mesecon",
+ drawtype = "nodebox",
+ walkable = false,
+ paramtype = "light",
+ sunlight_propagates = true,
+ selection_box = vertical_box,
+ node_box = vertical_box,
+ is_vertical_conductor = true,
+ drop = "mesecons_extrawires:vertical_off",
+ after_place_node = vertical_update,
+ after_dig_node = vertical_update
+},{
+ tiles = {"mesecons_wire_off.png"},
+ groups = {dig_immediate=3},
+ vertical_conductor_state = "off",
+ mesecons = {conductor = {
+ state = mesecon.state.off,
+ onstate = "mesecons_extrawires:vertical_on",
+ rules = vertical_rules,
+ }}
+},{
+ tiles = {"mesecons_wire_on.png"},
+ groups = {dig_immediate=3, not_in_creative_inventory=1},
+ vertical_conductor_state = "on",
+ mesecons = {conductor = {
+ state = mesecon.state.on,
+ offstate = "mesecons_extrawires:vertical_off",
+ rules = vertical_rules,
+ }}
+})
+
+-- Vertical wire top
+mesecon.register_node("mesecons_extrawires:vertical_top", {
+ description = "Vertical mesecon",
+ drawtype = "nodebox",
+ walkable = false,
+ paramtype = "light",
+ sunlight_propagates = true,
+ groups = {dig_immediate=3, not_in_creative_inventory=1},
+ selection_box = top_box,
+ node_box = top_box,
+ is_vertical_conductor = true,
+ drop = "mesecons_extrawires:vertical_off",
+ after_place_node = vertical_update,
+ after_dig_node = vertical_update
+},{
+ tiles = {"mesecons_wire_off.png"},
+ vertical_conductor_state = "off",
+ mesecons = {conductor = {
+ state = mesecon.state.off,
+ onstate = "mesecons_extrawires:vertical_top_on",
+ rules = top_rules,
+ }}
+},{
+ tiles = {"mesecons_wire_on.png"},
+ vertical_conductor_state = "on",
+ mesecons = {conductor = {
+ state = mesecon.state.on,
+ offstate = "mesecons_extrawires:vertical_top_off",
+ rules = top_rules,
+ }}
+})
+
+-- Vertical wire bottom
+mesecon.register_node("mesecons_extrawires:vertical_bottom", {
+ description = "Vertical mesecon",
+ drawtype = "nodebox",
+ walkable = false,
+ paramtype = "light",
+ sunlight_propagates = true,
+ groups = {dig_immediate = 3, not_in_creative_inventory = 1},
+ selection_box = bottom_box,
+ node_box = bottom_box,
+ is_vertical_conductor = true,
+ drop = "mesecons_extrawires:vertical_off",
+ after_place_node = vertical_update,
+ after_dig_node = vertical_update
+},{
+ tiles = {"mesecons_wire_off.png"},
+ vertical_conductor_state = "off",
+ mesecons = {conductor = {
+ state = mesecon.state.off,
+ onstate = "mesecons_extrawires:vertical_bottom_on",
+ rules = bottom_rules,
+ }}
+},{
+ tiles = {"mesecons_wire_on.png"},
+ vertical_conductor_state = "on",
+ mesecons = {conductor = {
+ state = mesecon.state.on,
+ offstate = "mesecons_extrawires:vertical_bottom_off",
+ rules = bottom_rules,
+ }}
+})
+
+minetest.register_craft({
+ output = "mesecons_extrawires:vertical_off 3",
+ recipe = {
+ {"mesecons:wire_00000000_off"},
+ {"mesecons:wire_00000000_off"},
+ {"mesecons:wire_00000000_off"}
+ }
+})
+
+minetest.register_craft({
+ output = "mesecons:wire_00000000_off",
+ recipe = {{"mesecons_extrawires:vertical_off"}}
+})