summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy <numzer0@yandex.ru>2020-08-24 00:30:57 +0300
committerGitHub <noreply@github.com>2020-08-24 00:30:57 +0300
commit9fda51b650c83aea82616055ae8814a722353bf4 (patch)
treef7132fa7ecdd856a1a6dd5d0e7201281abc81507
parent4750925eab62bc0f3513579be25ded407fecb049 (diff)
downloadmesecons-9fda51b650c83aea82616055ae8814a722353bf4.tar
mesecons-9fda51b650c83aea82616055ae8814a722353bf4.tar.gz
mesecons-9fda51b650c83aea82616055ae8814a722353bf4.tar.bz2
mesecons-9fda51b650c83aea82616055ae8814a722353bf4.tar.xz
mesecons-9fda51b650c83aea82616055ae8814a722353bf4.zip
Insulated double corner (#524)
* Add insulated double corner * Make single corner curved to match double corner * Remove obsolete regular corner textures
-rw-r--r--mesecons_extrawires/corner.lua29
-rw-r--r--mesecons_extrawires/doublecorner.lua91
-rw-r--r--mesecons_extrawires/init.lua1
-rw-r--r--mesecons_extrawires/models/mesecons_extrawires_corner.obj125
-rw-r--r--mesecons_extrawires/models/mesecons_extrawires_doublecorner.obj180
-rw-r--r--mesecons_insulated/textures/jeija_insulated_wire_curved_tb_off.pngbin136 -> 0 bytes
-rw-r--r--mesecons_insulated/textures/jeija_insulated_wire_curved_tb_on.pngbin136 -> 0 bytes
7 files changed, 405 insertions, 21 deletions
diff --git a/mesecons_extrawires/corner.lua b/mesecons_extrawires/corner.lua
index 1fc8410..b25c2a2 100644
--- a/mesecons_extrawires/corner.lua
+++ b/mesecons_extrawires/corner.lua
@@ -1,12 +1,5 @@
local screwdriver_exists = minetest.global_exists("screwdriver")
-local corner_nodebox = {
- type = "fixed",
- -- ±0.001 is to prevent z-fighting
- 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, -16/32, -16/32, 5/32, -12/32, 5/32 },
@@ -25,14 +18,11 @@ local corner_get_rules = function (node)
end
minetest.register_node("mesecons_extrawires:corner_on", {
- drawtype = "nodebox",
+ drawtype = "mesh",
+ mesh = "mesecons_extrawires_corner.obj",
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"
+ { name = "jeija_insulated_wire_sides_on.png", backface_culling = true },
+ { name = "jeija_insulated_wire_ends_on.png", backface_culling = true },
},
paramtype = "light",
paramtype2 = "facedir",
@@ -55,15 +45,12 @@ minetest.register_node("mesecons_extrawires:corner_on", {
})
minetest.register_node("mesecons_extrawires:corner_off", {
- drawtype = "nodebox",
+ drawtype = "mesh",
description = "Insulated Mesecon Corner",
+ mesh = "mesecons_extrawires_corner.obj",
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"
+ { name = "jeija_insulated_wire_sides_off.png", backface_culling = true },
+ { name = "jeija_insulated_wire_ends_off.png", backface_culling = true },
},
paramtype = "light",
paramtype2 = "facedir",
diff --git a/mesecons_extrawires/doublecorner.lua b/mesecons_extrawires/doublecorner.lua
new file mode 100644
index 0000000..d94e792
--- /dev/null
+++ b/mesecons_extrawires/doublecorner.lua
@@ -0,0 +1,91 @@
+local rotate
+if minetest.global_exists("screwdriver") then rotate = screwdriver.rotate_simple end
+
+local doublecorner_selectionbox = {
+ type = "fixed",
+ fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
+}
+
+local rules = {
+ {
+ { x = 1, y = 0, z = 0 },
+ { x = 0, y = 0, z = 1 },
+ },
+ {
+ { x = -1, y = 0, z = 0 },
+ { x = 0, y = 0, z = -1 },
+ },
+}
+
+local doublecorner_rules = {}
+for k = 1, 4 do
+ doublecorner_rules[k] = table.copy(rules)
+ for i, r in ipairs(rules) do
+ rules[i] = mesecon.rotate_rules_left(r)
+ end
+end
+
+local function doublecorner_get_rules(node)
+ return doublecorner_rules[node.param2 % 4 + 1]
+end
+
+local doublecorner_states = {
+ "mesecons_extrawires:doublecorner_00",
+ "mesecons_extrawires:doublecorner_01",
+ "mesecons_extrawires:doublecorner_10",
+ "mesecons_extrawires:doublecorner_11",
+}
+local wire1_states = { "off", "off", "on", "on" }
+local wire2_states = { "off", "on", "off", "on" }
+
+for k, state in ipairs(doublecorner_states) do
+ local w1 = wire1_states[k]
+ local w2 = wire2_states[k]
+ local groups = { dig_immediate = 3 }
+ if k ~= 1 then groups.not_in_creative_inventory = 1 end
+ minetest.register_node(state, {
+ drawtype = "mesh",
+ mesh = "mesecons_extrawires_doublecorner.obj",
+ description = "Insulated Mesecon Double Corner",
+ tiles = {
+ { name = "jeija_insulated_wire_sides_" .. w1 .. ".png", backface_culling = true },
+ { name = "jeija_insulated_wire_ends_" .. w1 .. ".png", backface_culling = true },
+ { name = "jeija_insulated_wire_sides_" .. w2 .. ".png", backface_culling = true },
+ { name = "jeija_insulated_wire_ends_" .. w2 .. ".png", backface_culling = true },
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ walkable = false,
+ sunlight_propagates = true,
+ selection_box = doublecorner_selectionbox,
+ groups = groups,
+ drop = doublecorner_states[1],
+ sounds = default.node_sound_defaults(),
+ mesecons = {
+ conductor = {
+ states = doublecorner_states,
+ rules = doublecorner_get_rules,
+ },
+ },
+ on_blast = mesecon.on_blastnode,
+ on_rotate = rotate,
+ })
+end
+
+minetest.register_craft({
+ type = "shapeless",
+ output = "mesecons_extrawires:doublecorner_00",
+ recipe = {
+ "mesecons_extrawires:corner_off",
+ "mesecons_extrawires:corner_off",
+ },
+})
+
+minetest.register_craft({
+ type = "shapeless",
+ output = "mesecons_extrawires:corner_off 2",
+ recipe = {
+ "mesecons_extrawires:doublecorner_00",
+ },
+})
diff --git a/mesecons_extrawires/init.lua b/mesecons_extrawires/init.lua
index b22f2e5..02dc1a6 100644
--- a/mesecons_extrawires/init.lua
+++ b/mesecons_extrawires/init.lua
@@ -1,5 +1,6 @@
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").."/doublecorner.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/vertical.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/mesewire.lua");
diff --git a/mesecons_extrawires/models/mesecons_extrawires_corner.obj b/mesecons_extrawires/models/mesecons_extrawires_corner.obj
new file mode 100644
index 0000000..c7b6b16
--- /dev/null
+++ b/mesecons_extrawires/models/mesecons_extrawires_corner.obj
@@ -0,0 +1,125 @@
+# Вершины
+# Провод 1
+# 1 (ниж. внутр.)
+v 0.093750 -0.531250 -0.501000
+v 0.093750 -0.531250 -0.331726
+v 0.331726 -0.531250 -0.093750
+v 0.501000 -0.531250 -0.093750
+# 5 (ниж. наруж.)
+v -0.093750 -0.531250 -0.501000
+v -0.093750 -0.531250 -0.254061
+v 0.254061 -0.531250 0.093750
+v 0.501000 -0.531250 0.093750
+# 9 (верх. внутр.)
+v 0.093750 -0.406250 -0.501000
+v 0.093750 -0.406250 -0.331726
+v 0.331726 -0.406250 -0.093750
+v 0.501000 -0.406250 -0.093750
+# 13 (верх. наруж.)
+v -0.093750 -0.406250 -0.501000
+v -0.093750 -0.406250 -0.254061
+v 0.254061 -0.406250 0.093750
+v 0.501000 -0.406250 0.093750
+# Текстурные координаты
+# 1 (ниж.)
+vt 0.000000 0.406250
+vt 0.168274 0.406250
+vt 0.331726 0.406250
+vt 0.668274 0.406250
+vt 0.831726 0.406250
+vt 1.000000 0.406250
+vt 0.000000 0.593750
+vt 0.245939 0.593750
+vt 0.254061 0.593750
+vt 0.745939 0.593750
+vt 0.754061 0.593750
+vt 1.000000 0.593750
+# 13 (верх.)
+vt 0.000000 0.406250
+vt 0.245939 0.406250
+vt 0.254061 0.406250
+vt 0.745939 0.406250
+vt 0.754061 0.406250
+vt 1.000000 0.406250
+vt 0.000000 0.593750
+vt 0.168274 0.593750
+vt 0.331726 0.593750
+vt 0.668274 0.593750
+vt 0.831726 0.593750
+vt 1.000000 0.593750
+# 25 (внутр.)
+vt 1.000000 0.093750
+vt 0.831726 0.093750
+vt 0.668274 0.093750
+vt 0.331726 0.093750
+vt 0.168274 0.093750
+vt 0.000000 0.093750
+vt 1.000000 -0.031250
+vt 0.831726 -0.031250
+vt 0.668274 -0.031250
+vt 0.331726 -0.031250
+vt 0.168274 -0.031250
+vt 0.000000 -0.031250
+# 37 (внеш.)
+vt 0.000000 -0.031250
+vt 0.245939 -0.031250
+vt 0.254061 -0.031250
+vt 0.745939 -0.031250
+vt 0.754061 -0.031250
+vt 1.000000 -0.031250
+vt 0.000000 0.093750
+vt 0.245939 0.093750
+vt 0.254061 0.093750
+vt 0.745939 0.093750
+vt 0.754061 0.093750
+vt 1.000000 0.093750
+# 49 (торец)
+vt 0.406250 -0.031250
+vt 0.406250 0.093750
+vt 0.593750 -0.031250
+vt 0.593750 0.093750
+# Нормали
+# 1
+vn 1.000000 0.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.707107 0.000000 0.707107
+# 5
+vn -1.000000 0.000000 0.000000
+vn 0.000000 -1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.707107 0.000000 -0.707107
+# Грани
+g Sides1
+# Часть 1
+f 5/37/1 6/38/1 14/44/1
+f 5/37/1 14/44/1 13/43/1
+f 13/13/2 14/14/2 10/20/2
+f 13/13/2 10/20/2 9/19/2
+f 9/25/5 10/26/5 2/32/5
+f 9/25/5 2/32/5 1/31/5
+f 1/1/6 2/2/6 6/8/6
+f 1/1/6 6/8/6 5/7/6
+# Часть 2
+f 6/39/4 7/40/4 15/46/4
+f 6/39/4 15/46/4 14/45/4
+f 14/15/2 15/16/2 11/22/2
+f 14/15/2 11/22/2 10/21/2
+f 10/27/8 11/28/8 3/34/8
+f 10/27/8 3/34/8 2/33/8
+f 2/3/6 3/4/6 7/10/6
+f 2/3/6 7/10/6 6/9/6
+# Часть 3
+f 7/41/3 8/42/3 16/48/3
+f 7/41/3 16/48/3 15/47/3
+f 15/17/2 16/18/2 12/24/2
+f 15/17/2 12/24/2 11/23/2
+f 11/29/7 12/30/7 4/36/7
+f 11/29/7 4/36/7 3/35/7
+f 3/5/6 4/6/6 8/12/6
+f 3/5/6 8/12/6 7/11/6
+g Ends1
+f 1/49/3 5/51/3 13/52/3
+f 1/49/3 13/52/3 9/50/3
+f 4/49/1 12/50/1 16/52/1
+f 4/49/1 16/52/1 8/51/1
diff --git a/mesecons_extrawires/models/mesecons_extrawires_doublecorner.obj b/mesecons_extrawires/models/mesecons_extrawires_doublecorner.obj
new file mode 100644
index 0000000..a74aa01
--- /dev/null
+++ b/mesecons_extrawires/models/mesecons_extrawires_doublecorner.obj
@@ -0,0 +1,180 @@
+# Вершины
+# Провод 1
+# 1 (ниж. внутр.)
+v 0.093750 -0.531250 -0.501000
+v 0.093750 -0.531250 -0.331726
+v 0.331726 -0.531250 -0.093750
+v 0.501000 -0.531250 -0.093750
+# 5 (ниж. наруж.)
+v -0.093750 -0.531250 -0.501000
+v -0.093750 -0.531250 -0.254061
+v 0.254061 -0.531250 0.093750
+v 0.501000 -0.531250 0.093750
+# 9 (верх. внутр.)
+v 0.093750 -0.406250 -0.501000
+v 0.093750 -0.406250 -0.331726
+v 0.331726 -0.406250 -0.093750
+v 0.501000 -0.406250 -0.093750
+# 13 (верх. наруж.)
+v -0.093750 -0.406250 -0.501000
+v -0.093750 -0.406250 -0.254061
+v 0.254061 -0.406250 0.093750
+v 0.501000 -0.406250 0.093750
+# Провод 2
+# 17 (ниж. внутр.)
+v -0.093750 -0.531250 0.501000
+v -0.093750 -0.531250 0.331726
+v -0.331726 -0.531250 0.093750
+v -0.501000 -0.531250 0.093750
+# 21 (ниж. наруж.)
+v 0.093750 -0.531250 0.501000
+v 0.093750 -0.531250 0.254061
+v -0.254061 -0.531250 -0.093750
+v -0.501000 -0.531250 -0.093750
+# 25 (верх. внутр.)
+v -0.093750 -0.406250 0.501000
+v -0.093750 -0.406250 0.331726
+v -0.331726 -0.406250 0.093750
+v -0.501000 -0.406250 0.093750
+# 29 (верх. наруж.)
+v 0.093750 -0.406250 0.501000
+v 0.093750 -0.406250 0.254061
+v -0.254061 -0.406250 -0.093750
+v -0.501000 -0.406250 -0.093750
+# Текстурные координаты
+# 1 (ниж.)
+vt 0.000000 0.406250
+vt 0.168274 0.406250
+vt 0.331726 0.406250
+vt 0.668274 0.406250
+vt 0.831726 0.406250
+vt 1.000000 0.406250
+vt 0.000000 0.593750
+vt 0.245939 0.593750
+vt 0.254061 0.593750
+vt 0.745939 0.593750
+vt 0.754061 0.593750
+vt 1.000000 0.593750
+# 13 (верх.)
+vt 0.000000 0.406250
+vt 0.245939 0.406250
+vt 0.254061 0.406250
+vt 0.745939 0.406250
+vt 0.754061 0.406250
+vt 1.000000 0.406250
+vt 0.000000 0.593750
+vt 0.168274 0.593750
+vt 0.331726 0.593750
+vt 0.668274 0.593750
+vt 0.831726 0.593750
+vt 1.000000 0.593750
+# 25 (внутр.)
+vt 1.000000 0.093750
+vt 0.831726 0.093750
+vt 0.668274 0.093750
+vt 0.331726 0.093750
+vt 0.168274 0.093750
+vt 0.000000 0.093750
+vt 1.000000 -0.031250
+vt 0.831726 -0.031250
+vt 0.668274 -0.031250
+vt 0.331726 -0.031250
+vt 0.168274 -0.031250
+vt 0.000000 -0.031250
+# 37 (внеш.)
+vt 0.000000 -0.031250
+vt 0.245939 -0.031250
+vt 0.254061 -0.031250
+vt 0.745939 -0.031250
+vt 0.754061 -0.031250
+vt 1.000000 -0.031250
+vt 0.000000 0.093750
+vt 0.245939 0.093750
+vt 0.254061 0.093750
+vt 0.745939 0.093750
+vt 0.754061 0.093750
+vt 1.000000 0.093750
+# 49 (торец)
+vt 0.406250 -0.031250
+vt 0.406250 0.093750
+vt 0.593750 -0.031250
+vt 0.593750 0.093750
+# Нормали
+# 1
+vn 1.000000 0.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.707107 0.000000 0.707107
+# 5
+vn -1.000000 0.000000 0.000000
+vn 0.000000 -1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.707107 0.000000 -0.707107
+# Грани
+# Грани
+g Sides1
+# Часть 1
+f 5/37/1 6/38/1 14/44/1
+f 5/37/1 14/44/1 13/43/1
+f 13/13/2 14/14/2 10/20/2
+f 13/13/2 10/20/2 9/19/2
+f 9/25/5 10/26/5 2/32/5
+f 9/25/5 2/32/5 1/31/5
+f 1/1/6 2/2/6 6/8/6
+f 1/1/6 6/8/6 5/7/6
+# Часть 2
+f 6/39/4 7/40/4 15/46/4
+f 6/39/4 15/46/4 14/45/4
+f 14/15/2 15/16/2 11/22/2
+f 14/15/2 11/22/2 10/21/2
+f 10/27/8 11/28/8 3/34/8
+f 10/27/8 3/34/8 2/33/8
+f 2/3/6 3/4/6 7/10/6
+f 2/3/6 7/10/6 6/9/6
+# Часть 3
+f 7/41/3 8/42/3 16/48/3
+f 7/41/3 16/48/3 15/47/3
+f 15/17/2 16/18/2 12/24/2
+f 15/17/2 12/24/2 11/23/2
+f 11/29/7 12/30/7 4/36/7
+f 11/29/7 4/36/7 3/35/7
+f 3/5/6 4/6/6 8/12/6
+f 3/5/6 8/12/6 7/11/6
+g Ends1
+f 1/49/3 5/51/3 13/52/3
+f 1/49/3 13/52/3 9/50/3
+f 4/49/1 12/50/1 16/52/1
+f 4/49/1 16/52/1 8/51/1
+g Sides2
+# Часть 1
+f 21/37/1 22/38/1 30/44/1
+f 21/37/1 30/44/1 29/43/1
+f 29/13/2 30/14/2 26/20/2
+f 29/13/2 26/20/2 25/19/2
+f 25/25/5 26/26/5 18/32/5
+f 25/25/5 18/32/5 17/31/5
+f 17/1/6 18/2/6 22/8/6
+f 17/1/6 22/8/6 21/7/6
+# Часть 2
+f 22/39/4 23/40/4 31/46/4
+f 22/39/4 31/46/4 30/45/4
+f 30/15/2 31/16/2 27/22/2
+f 30/15/2 27/22/2 26/21/2
+f 26/27/8 27/28/8 19/34/8
+f 26/27/8 19/34/8 18/33/8
+f 18/3/6 19/4/6 23/10/6
+f 18/3/6 23/10/6 22/9/6
+# Часть 3
+f 23/41/3 24/42/3 32/48/3
+f 23/41/3 32/48/3 31/47/3
+f 31/17/2 32/18/2 28/24/2
+f 31/17/2 28/24/2 27/23/2
+f 27/29/7 28/30/7 20/36/7
+f 27/29/7 20/36/7 19/35/7
+f 19/5/6 20/6/6 24/12/6
+f 19/5/6 24/12/6 23/11/6
+g Ends2
+f 17/49/3 21/51/3 29/52/3
+f 17/49/3 29/52/3 25/50/3
+f 20/49/1 28/50/1 32/52/1
+f 20/49/1 32/52/1 24/51/1
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_off.png b/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_off.png
deleted file mode 100644
index dcc96c7..0000000
--- a/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_off.png
+++ /dev/null
Binary files differ
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_on.png b/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_on.png
deleted file mode 100644
index 321f931..0000000
--- a/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_on.png
+++ /dev/null
Binary files differ