From bec349ed8f83b6befe597076744e2311dc86b67f Mon Sep 17 00:00:00 2001
From: Vanessa Ezekowitz <vanessaezekowitz@gmail.com>
Date: Sun, 5 Feb 2017 20:21:30 -0500
Subject: update castles and unified dyes mods

---
 castle/depends.txt                                |   3 +-
 castle/init.lua                                   |  15 ++
 castle/models/castle_tapestry.obj                 | 212 +++++++++++++++
 castle/models/castle_tapestry_long.obj            | 220 +++++++++++++++
 castle/models/castle_tapestry_very_long.obj       | 228 ++++++++++++++++
 castle/tapestry.lua                               | 311 +++++++++++-----------
 castle/textures/castle_tapestry.png               | Bin 0 -> 323 bytes
 castle/textures/castle_tapestry_inv.png           | Bin 0 -> 2062 bytes
 castle/textures/castle_tapestry_long_inv.png      | Bin 0 -> 1822 bytes
 castle/textures/castle_tapestry_very_long_inv.png | Bin 0 -> 1376 bytes
 10 files changed, 833 insertions(+), 156 deletions(-)
 create mode 100644 castle/models/castle_tapestry.obj
 create mode 100644 castle/models/castle_tapestry_long.obj
 create mode 100644 castle/models/castle_tapestry_very_long.obj
 create mode 100644 castle/textures/castle_tapestry.png
 create mode 100644 castle/textures/castle_tapestry_inv.png
 create mode 100644 castle/textures/castle_tapestry_long_inv.png
 create mode 100644 castle/textures/castle_tapestry_very_long_inv.png

(limited to 'castle')

diff --git a/castle/depends.txt b/castle/depends.txt
index 66ca057..da4fb74 100644
--- a/castle/depends.txt
+++ b/castle/depends.txt
@@ -2,8 +2,9 @@ default
 stairs
 doors
 farming
+unifieddyes
 building_blocks?
 asphalt?
 streets?
 moreblocks?
-xpanes?
\ No newline at end of file
+xpanes?
diff --git a/castle/init.lua b/castle/init.lua
index ed82a66..11b239d 100644
--- a/castle/init.lua
+++ b/castle/init.lua
@@ -1,3 +1,16 @@
+castle = {}
+
+-- use this when you have a "wallmounted" node that should never be oriented
+-- to floor or ceiling (e.g. a tapestry)
+
+function castle.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
+	local node = minetest.get_node(pos)
+	local yaw = placer:get_look_yaw()
+	local dir = minetest.yaw_to_dir(yaw)
+	local fdir = minetest.dir_to_wallmounted(dir)
+	minetest.swap_node(pos, { name = node.name, param2 = fdir })
+end
+
 dofile(minetest.get_modpath("castle").."/pillars.lua")
 dofile(minetest.get_modpath("castle").."/arrowslit.lua")
 dofile(minetest.get_modpath("castle").."/tapestry.lua")
@@ -9,6 +22,8 @@ dofile(minetest.get_modpath("castle").."/orbs.lua")
 dofile(minetest.get_modpath("castle").."/rope.lua")
 dofile(minetest.get_modpath("castle").."/crossbow.lua")
 
+-- nodes
+
 minetest.register_node("castle:stonewall", {
 	description = "Castle Wall",
 	drawtype = "normal",
diff --git a/castle/models/castle_tapestry.obj b/castle/models/castle_tapestry.obj
new file mode 100644
index 0000000..5465c46
--- /dev/null
+++ b/castle/models/castle_tapestry.obj
@@ -0,0 +1,212 @@
+# Blender v2.72 (sub 0) OBJ File: 'castle_tapestry.blend'
+# www.blender.org
+o Cube
+v -0.500000 0.500000 -0.125000
+v -0.437500 0.500000 -0.125000
+v -0.500000 0.500000 1.500000
+v -0.437500 0.500000 1.500000
+v -0.437500 -0.500000 1.500000
+v -0.500000 -0.500000 1.500000
+v -0.437500 0.125000 -0.250000
+v -0.500000 0.125000 -0.250000
+v -0.500000 0.125000 -0.375000
+v -0.437500 0.125000 -0.375000
+v -0.437500 0.187500 -0.375000
+v -0.500000 0.187500 -0.375000
+v -0.500000 0.312500 -0.500000
+v -0.437500 0.312500 -0.500000
+v -0.437500 0.312500 -0.375000
+v -0.500000 0.312500 -0.375000
+v -0.500000 0.375000 -0.375000
+v -0.437500 0.375000 -0.375000
+v -0.437500 0.375000 -0.250000
+v -0.500000 0.375000 -0.250000
+v -0.437500 -0.187500 -0.500000
+v -0.500000 -0.312500 -0.500000
+v -0.437500 -0.312500 -0.500000
+v -0.500000 0.187500 -0.500000
+v -0.437500 0.187500 -0.500000
+v -0.500000 0.437500 -0.250000
+v -0.437500 0.437500 -0.250000
+v -0.437500 0.437500 -0.125000
+v -0.500000 0.437500 -0.125000
+v -0.437500 0.062500 -0.250000
+v -0.500000 0.062500 -0.250000
+v -0.437500 0.062500 -0.125000
+v -0.500000 0.062500 -0.125000
+v -0.437500 -0.062500 -0.125000
+v -0.500000 -0.062500 -0.125000
+v -0.437500 -0.062500 -0.250000
+v -0.500000 -0.062500 -0.250000
+v -0.437500 -0.125000 -0.250000
+v -0.500000 -0.125000 -0.250000
+v -0.437500 -0.125000 -0.375000
+v -0.500000 -0.125000 -0.375000
+v -0.437500 -0.187500 -0.375000
+v -0.500000 -0.187500 -0.375000
+v -0.500000 -0.187500 -0.500000
+v -0.500000 -0.312500 -0.375000
+v -0.437500 -0.312500 -0.375000
+v -0.500000 -0.375000 -0.375000
+v -0.437500 -0.375000 -0.375000
+v -0.500000 -0.375000 -0.250000
+v -0.437500 -0.375000 -0.250000
+v -0.500000 -0.437500 -0.250000
+v -0.437500 -0.437500 -0.250000
+v -0.500000 -0.437500 -0.125000
+v -0.437500 -0.437500 -0.125000
+v -0.500000 -0.500000 -0.125000
+v -0.437500 -0.500000 -0.125000
+v -0.500000 0.500000 0.500000
+v -0.437500 0.500000 0.500000
+v -0.500000 -0.500000 0.500000
+v -0.437500 -0.500000 0.500000
+v -0.500000 0.343750 -0.375000
+vt 0.062500 0.000000
+vt 0.062500 1.000000
+vt 0.000000 1.000000
+vt 0.000003 0.000000
+vt 0.937500 0.250000
+vt 1.000000 0.250000
+vt 1.000000 0.375000
+vt 0.937500 0.375000
+vt 0.625000 0.937500
+vt 0.625000 0.999999
+vt 0.562500 0.999999
+vt 0.562500 0.937500
+vt 0.937500 0.125000
+vt 1.000000 0.125000
+vt 0.687500 0.937500
+vt 0.687500 0.999999
+vt 0.937500 0.000000
+vt 1.000000 0.000000
+vt 0.062500 0.125000
+vt 0.000000 0.125000
+vt 0.875000 0.937500
+vt 0.875000 1.000000
+vt 0.812500 1.000000
+vt 0.812500 0.937500
+vt 0.843750 0.937500
+vt 0.062500 0.250000
+vt 0.000000 0.250000
+vt 0.937500 0.937500
+vt 0.937500 1.000000
+vt 0.062500 0.375000
+vt 0.000000 0.375000
+vt 1.000000 0.937500
+vt 1.000000 1.000000
+vt 0.437500 0.937500
+vt 0.437500 0.999999
+vt 0.375000 0.999999
+vt 0.375000 0.937500
+vt 0.312500 0.999999
+vt 0.312500 0.937500
+vt 0.187500 0.937500
+vt 0.187500 0.999999
+vt 0.125000 0.999999
+vt 0.125000 0.937500
+vt 0.062500 0.937500
+vt 0.000000 0.937500
+vt 0.625000 0.000000
+vt 0.625000 0.062500
+vt 0.625000 0.437500
+vt 0.625000 0.562500
+vt 0.375000 0.437500
+vt 0.375000 0.062500
+vt 0.375000 0.000000
+vt 0.375000 0.562500
+vt 0.250000 0.437500
+vt 0.250000 0.375000
+vt 0.250000 0.125000
+vt 0.250000 0.062500
+vt 0.250000 0.937500
+vt 0.250000 0.875000
+vt 0.250000 0.625000
+vt 0.250000 0.562500
+vt 0.750000 0.562500
+vt 0.750000 0.625000
+vt 0.750000 0.875000
+vt 0.750000 0.937500
+vt 0.750000 0.062500
+vt 0.750000 0.125000
+vt 0.750000 0.375000
+vt 0.750000 0.437500
+vt 0.875000 0.625000
+vt 0.875000 0.687500
+vt 0.875000 0.812500
+vt 0.875000 0.875000
+vt 0.875000 0.125000
+vt 0.875000 0.156250
+vt 0.875000 0.187500
+vt 0.875000 0.312500
+vt 0.875000 0.375000
+vt 1.000000 0.687500
+vt 1.000000 0.812500
+vt 1.000000 0.187500
+vt 1.000000 0.312500
+vt 0.125000 0.187500
+vt 0.125000 0.312500
+vt 0.000000 0.312500
+vt 0.000000 0.187500
+vt 0.125000 0.687500
+vt 0.125000 0.812500
+vt 0.000000 0.812500
+vt 0.000000 0.687500
+vt 0.125000 0.875000
+vt 0.125000 0.625000
+vt 0.125000 0.375000
+vt 0.125000 0.125000
+vn 0.000000 1.000000 -0.000000
+vn -0.000000 -1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -1.000000 0.000000 0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 0.000000 0.000000 1.000000
+g Cube_Cube_Material
+s off
+f 57/1/1 3/2/1 4/3/1 58/4/1
+f 31/5/2 30/6/2 32/7/2 33/8/2
+f 8/9/3 7/10/3 30/11/3 31/12/3
+f 9/13/2 10/14/2 7/6/2 8/5/2
+f 12/15/3 11/16/3 10/10/3 9/9/3
+f 24/17/2 25/18/2 11/14/2 12/13/2
+f 16/19/1 15/20/1 14/4/1 13/1/1
+f 17/21/3 18/22/3 15/23/3 16/24/3 61/25/3
+f 20/26/1 19/27/1 18/20/1 17/19/1
+f 26/28/3 27/29/3 19/22/3 20/21/3
+f 29/30/1 28/31/1 27/27/1 26/26/1
+f 1/32/3 2/33/3 28/29/3 29/28/3
+f 37/34/3 36/35/3 38/36/3 39/37/3
+f 39/26/1 38/27/1 40/20/1 41/19/1
+f 41/37/3 40/36/3 42/38/3 43/39/3
+f 22/17/2 23/18/2 46/14/2 45/13/2
+f 45/40/3 46/41/3 48/42/3 47/43/3
+f 47/13/2 48/14/2 50/6/2 49/5/2
+f 49/43/3 50/42/3 52/2/3 51/44/3
+f 51/5/2 52/6/2 54/7/2 53/8/2
+f 53/44/3 54/2/3 56/3/3 55/45/3
+f 43/19/1 42/20/1 21/4/1 44/1/1
+f 14/23/3 25/16/3 24/15/3 13/24/3
+f 60/18/2 5/33/2 6/29/2 59/17/2
+f 21/38/3 23/41/3 22/40/3 44/39/3
+f 57/18/4 59/33/4 6/3/4 3/4/4
+f 60/3/5 58/4/5 4/18/5 5/33/5
+f 1/30/1 57/2/1 58/3/1 2/31/1
+f 56/7/2 60/33/2 59/29/2 55/8/2
+f 1/46/4 29/47/4 33/48/4 35/49/4 53/9/4 55/10/4 59/3/4 57/4/4
+f 32/50/5 28/51/5 2/52/5 58/18/5 60/33/5 56/36/5 54/37/5 34/53/5
+f 34/31/1 36/27/1 37/26/1 35/30/1
+f 30/54/5 7/55/5 19/56/5 27/57/5 28/51/5 32/50/5
+f 34/53/5 54/37/5 52/58/5 50/59/5 38/60/5 36/61/5
+f 53/9/4 35/49/4 37/62/4 39/63/4 49/64/4 51/65/4
+f 29/47/4 26/66/4 20/67/4 8/68/4 31/69/4 33/48/4
+f 33/12/3 32/11/3 34/35/3 35/34/3
+f 49/64/4 39/63/4 41/70/4 43/71/4 45/72/4 47/73/4
+f 8/68/4 20/67/4 17/74/4 61/75/4 16/76/4 12/77/4 9/78/4
+f 45/72/4 43/71/4 44/79/4 22/80/4
+f 12/77/4 16/76/4 13/81/4 24/82/4
+f 15/83/5 11/84/5 25/85/5 14/86/5
+f 42/87/5 46/88/5 23/89/5 21/90/5
+f 38/60/5 50/59/5 48/91/5 46/88/5 42/87/5 40/92/5
+f 7/55/5 10/93/5 11/84/5 15/83/5 18/94/5 19/56/5
+f 3/33/6 6/3/6 5/45/6 4/32/6
diff --git a/castle/models/castle_tapestry_long.obj b/castle/models/castle_tapestry_long.obj
new file mode 100644
index 0000000..f240853
--- /dev/null
+++ b/castle/models/castle_tapestry_long.obj
@@ -0,0 +1,220 @@
+# Blender v2.72 (sub 0) OBJ File: 'castle_tapestry_long.blend'
+# www.blender.org
+o Cube
+v -0.500000 0.500000 -0.125000
+v -0.437500 0.500000 -0.125000
+v -0.500000 0.500001 1.500000
+v -0.437499 0.500000 1.500000
+v -0.437500 -0.500000 1.500000
+v -0.500000 -0.500000 1.500000
+v -0.437500 0.125000 -0.250000
+v -0.500000 0.125000 -0.250000
+v -0.500000 0.125000 -0.375000
+v -0.437500 0.125000 -0.375000
+v -0.437500 0.187500 -0.375000
+v -0.500000 0.187500 -0.375000
+v -0.500000 0.312500 -0.500000
+v -0.437500 0.312500 -0.500000
+v -0.437500 0.312500 -0.375000
+v -0.500000 0.312500 -0.375000
+v -0.500000 0.375000 -0.375000
+v -0.437500 0.375000 -0.375000
+v -0.437500 0.375000 -0.250000
+v -0.500000 0.375000 -0.250000
+v -0.437500 -0.187500 -0.500000
+v -0.500000 -0.312500 -0.500000
+v -0.437500 -0.312500 -0.500000
+v -0.500000 0.187500 -0.500000
+v -0.437500 0.187500 -0.500000
+v -0.500000 0.437500 -0.250000
+v -0.437500 0.437500 -0.250000
+v -0.437500 0.437500 -0.125000
+v -0.500000 0.437500 -0.125000
+v -0.437500 0.062500 -0.250000
+v -0.500000 0.062500 -0.250000
+v -0.437500 0.062500 -0.125000
+v -0.500000 0.062500 -0.125000
+v -0.437500 -0.062500 -0.125000
+v -0.500000 -0.062500 -0.125000
+v -0.437500 -0.062500 -0.250000
+v -0.500000 -0.062500 -0.250000
+v -0.437500 -0.125000 -0.250000
+v -0.500000 -0.125000 -0.250000
+v -0.437500 -0.125000 -0.375000
+v -0.500000 -0.125000 -0.375000
+v -0.437500 -0.187500 -0.375000
+v -0.500000 -0.187500 -0.375000
+v -0.500000 -0.187500 -0.500000
+v -0.500000 -0.312500 -0.375000
+v -0.437500 -0.312500 -0.375000
+v -0.500000 -0.375000 -0.375000
+v -0.437500 -0.375000 -0.375000
+v -0.500000 -0.375000 -0.250000
+v -0.437500 -0.375000 -0.250000
+v -0.500000 -0.437500 -0.250000
+v -0.437500 -0.437500 -0.250000
+v -0.500000 -0.437500 -0.125000
+v -0.437500 -0.437500 -0.125000
+v -0.500000 -0.500000 -0.125000
+v -0.437500 -0.500000 -0.125000
+v -0.500000 0.500000 0.500000
+v -0.437500 0.500000 0.500000
+v -0.500000 -0.500000 0.500000
+v -0.437500 -0.500000 0.500000
+v -0.500000 0.500001 2.500000
+v -0.437499 0.500000 2.500000
+v -0.437500 -0.500000 2.500000
+v -0.500000 -0.500000 2.500000
+v -0.500000 0.343750 -0.375000
+vt 0.062500 0.000000
+vt 0.062500 1.000000
+vt 0.000000 1.000000
+vt 0.000003 0.000000
+vt 0.937500 0.250000
+vt 1.000000 0.250000
+vt 1.000000 0.375000
+vt 0.937500 0.375000
+vt 0.625000 0.937500
+vt 0.625000 0.999999
+vt 0.562500 0.999999
+vt 0.562500 0.937500
+vt 0.937500 0.125000
+vt 1.000000 0.125000
+vt 0.687500 0.937500
+vt 0.687500 0.999999
+vt 0.937500 0.000000
+vt 1.000000 0.000000
+vt 0.062500 0.125000
+vt 0.000000 0.125000
+vt 0.875000 0.937500
+vt 0.875000 1.000000
+vt 0.812500 1.000000
+vt 0.812500 0.937500
+vt 0.843750 0.937500
+vt 0.062500 0.250000
+vt 0.000000 0.250000
+vt 0.937500 0.937500
+vt 0.937500 1.000000
+vt 0.062500 0.375000
+vt 0.000000 0.375000
+vt 1.000000 0.937500
+vt 1.000000 1.000000
+vt 0.437500 0.937500
+vt 0.437500 0.999999
+vt 0.375000 0.999999
+vt 0.375000 0.937500
+vt 0.312500 0.999999
+vt 0.312500 0.937500
+vt 0.187500 0.937500
+vt 0.187500 0.999999
+vt 0.125000 0.999999
+vt 0.125000 0.937500
+vt 0.062500 0.937500
+vt 0.000000 0.937500
+vt 0.625000 0.000000
+vt 0.625000 0.062500
+vt 0.625000 0.437500
+vt 0.625000 0.562500
+vt 0.375000 0.437500
+vt 0.375000 0.062500
+vt 0.375000 0.000000
+vt 0.375000 0.562500
+vt 0.250000 0.437500
+vt 0.250000 0.375000
+vt 0.250000 0.125000
+vt 0.250000 0.062500
+vt 0.250000 0.937500
+vt 0.250000 0.875000
+vt 0.250000 0.625000
+vt 0.250000 0.562500
+vt 0.750000 0.562500
+vt 0.750000 0.625000
+vt 0.750000 0.875000
+vt 0.750000 0.937500
+vt 0.750000 0.062500
+vt 0.750000 0.125000
+vt 0.750000 0.375000
+vt 0.750000 0.437500
+vt 0.875000 0.625000
+vt 0.875000 0.687500
+vt 0.875000 0.812500
+vt 0.875000 0.875000
+vt 0.875000 0.125000
+vt 0.875000 0.156250
+vt 0.875000 0.187500
+vt 0.875000 0.312500
+vt 0.875000 0.375000
+vt 1.000000 0.687500
+vt 1.000000 0.812500
+vt 1.000000 0.187500
+vt 1.000000 0.312500
+vt 0.125000 0.187500
+vt 0.125000 0.312500
+vt 0.000000 0.312500
+vt 0.000000 0.187500
+vt 0.125000 0.687500
+vt 0.125000 0.812500
+vt 0.000000 0.812500
+vt 0.000000 0.687500
+vt 0.125000 0.875000
+vt 0.125000 0.625000
+vt 0.125000 0.375000
+vt 0.125000 0.125000
+vn 0.000000 1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -1.000000 0.000000 0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 0.000000 0.000000 1.000000
+g Cube_Cube_Material
+s off
+f 57/1/1 3/2/1 4/3/1 58/4/1
+f 31/5/2 30/6/2 32/7/2 33/8/2
+f 8/9/3 7/10/3 30/11/3 31/12/3
+f 9/13/2 10/14/2 7/6/2 8/5/2
+f 12/15/3 11/16/3 10/10/3 9/9/3
+f 24/17/2 25/18/2 11/14/2 12/13/2
+f 16/19/1 15/20/1 14/4/1 13/1/1
+f 17/21/3 18/22/3 15/23/3 16/24/3 65/25/3
+f 20/26/1 19/27/1 18/20/1 17/19/1
+f 26/28/3 27/29/3 19/22/3 20/21/3
+f 29/30/1 28/31/1 27/27/1 26/26/1
+f 1/32/3 2/33/3 28/29/3 29/28/3
+f 37/34/3 36/35/3 38/36/3 39/37/3
+f 39/26/1 38/27/1 40/20/1 41/19/1
+f 41/37/3 40/36/3 42/38/3 43/39/3
+f 22/17/2 23/18/2 46/14/2 45/13/2
+f 45/40/3 46/41/3 48/42/3 47/43/3
+f 47/13/2 48/14/2 50/6/2 49/5/2
+f 49/43/3 50/42/3 52/2/3 51/44/3
+f 51/5/2 52/6/2 54/7/2 53/8/2
+f 53/44/3 54/2/3 56/3/3 55/45/3
+f 43/19/1 42/20/1 21/4/1 44/1/1
+f 14/23/3 25/16/3 24/15/3 13/24/3
+f 60/18/2 5/33/2 6/29/2 59/17/2
+f 21/38/3 23/41/3 22/40/3 44/39/3
+f 57/18/4 59/33/4 6/3/4 3/4/4
+f 60/3/5 58/4/5 4/18/5 5/33/5
+f 1/30/1 57/2/1 58/3/1 2/31/1
+f 56/7/2 60/33/2 59/29/2 55/8/2
+f 1/46/4 29/47/4 33/48/4 35/49/4 53/9/4 55/10/4 59/3/4 57/4/4
+f 32/50/5 28/51/5 2/52/5 58/18/5 60/33/5 56/36/5 54/37/5 34/53/5
+f 34/31/1 36/27/1 37/26/1 35/30/1
+f 30/54/5 7/55/5 19/56/5 27/57/5 28/51/5 32/50/5
+f 34/53/5 54/37/5 52/58/5 50/59/5 38/60/5 36/61/5
+f 53/9/4 35/49/4 37/62/4 39/63/4 49/64/4 51/65/4
+f 29/47/4 26/66/4 20/67/4 8/68/4 31/69/4 33/48/4
+f 33/12/3 32/11/3 34/35/3 35/34/3
+f 3/1/1 61/2/1 62/3/1 4/4/1
+f 5/18/2 63/33/2 64/29/2 6/17/2
+f 3/18/4 6/33/4 64/3/4 61/4/4
+f 5/3/5 4/4/5 62/18/5 63/33/5
+f 49/64/4 39/63/4 41/70/4 43/71/4 45/72/4 47/73/4
+f 8/68/4 20/67/4 17/74/4 65/75/4 16/76/4 12/77/4 9/78/4
+f 45/72/4 43/71/4 44/79/4 22/80/4
+f 12/77/4 16/76/4 13/81/4 24/82/4
+f 15/83/5 11/84/5 25/85/5 14/86/5
+f 42/87/5 46/88/5 23/89/5 21/90/5
+f 38/60/5 50/59/5 48/91/5 46/88/5 42/87/5 40/92/5
+f 7/55/5 10/93/5 11/84/5 15/83/5 18/94/5 19/56/5
+f 61/33/6 64/3/6 63/45/6 62/32/6
diff --git a/castle/models/castle_tapestry_very_long.obj b/castle/models/castle_tapestry_very_long.obj
new file mode 100644
index 0000000..bfe9843
--- /dev/null
+++ b/castle/models/castle_tapestry_very_long.obj
@@ -0,0 +1,228 @@
+# Blender v2.72 (sub 0) OBJ File: 'castle_tapestry_very_long.blend'
+# www.blender.org
+o Cube
+v -0.500000 0.500000 -0.125000
+v -0.437500 0.500000 -0.125000
+v -0.500000 0.500001 1.500000
+v -0.437499 0.500000 1.500000
+v -0.437500 -0.500000 1.500000
+v -0.500000 -0.500000 1.500000
+v -0.437500 0.125000 -0.250000
+v -0.500000 0.125000 -0.250000
+v -0.500000 0.125000 -0.375000
+v -0.437500 0.125000 -0.375000
+v -0.437500 0.187500 -0.375000
+v -0.500000 0.187500 -0.375000
+v -0.500000 0.312500 -0.500000
+v -0.437500 0.312500 -0.500000
+v -0.437500 0.312500 -0.375000
+v -0.500000 0.312500 -0.375000
+v -0.500000 0.375000 -0.375000
+v -0.437500 0.375000 -0.375000
+v -0.437500 0.375000 -0.250000
+v -0.500000 0.375000 -0.250000
+v -0.437500 -0.187500 -0.500000
+v -0.500000 -0.312500 -0.500000
+v -0.437500 -0.312500 -0.500000
+v -0.500000 0.187500 -0.500000
+v -0.437500 0.187500 -0.500000
+v -0.500000 0.437500 -0.250000
+v -0.437500 0.437500 -0.250000
+v -0.437500 0.437500 -0.125000
+v -0.500000 0.437500 -0.125000
+v -0.437500 0.062500 -0.250000
+v -0.500000 0.062500 -0.250000
+v -0.437500 0.062500 -0.125000
+v -0.500000 0.062500 -0.125000
+v -0.437500 -0.062500 -0.125000
+v -0.500000 -0.062500 -0.125000
+v -0.437500 -0.062500 -0.250000
+v -0.500000 -0.062500 -0.250000
+v -0.437500 -0.125000 -0.250000
+v -0.500000 -0.125000 -0.250000
+v -0.437500 -0.125000 -0.375000
+v -0.500000 -0.125000 -0.375000
+v -0.437500 -0.187500 -0.375000
+v -0.500000 -0.187500 -0.375000
+v -0.500000 -0.187500 -0.500000
+v -0.500000 -0.312500 -0.375000
+v -0.437500 -0.312500 -0.375000
+v -0.500000 -0.375000 -0.375000
+v -0.437500 -0.375000 -0.375000
+v -0.500000 -0.375000 -0.250000
+v -0.437500 -0.375000 -0.250000
+v -0.500000 -0.437500 -0.250000
+v -0.437500 -0.437500 -0.250000
+v -0.500000 -0.437500 -0.125000
+v -0.437500 -0.437500 -0.125000
+v -0.500000 -0.500000 -0.125000
+v -0.437500 -0.500000 -0.125000
+v -0.500000 0.500000 0.500000
+v -0.437500 0.500000 0.500000
+v -0.500000 -0.500000 0.500000
+v -0.437500 -0.500000 0.500000
+v -0.500000 0.500001 2.500000
+v -0.437499 0.500000 2.500000
+v -0.437500 -0.500000 2.500000
+v -0.500000 -0.500000 2.500000
+v -0.500000 0.500001 3.500000
+v -0.437499 0.500000 3.500000
+v -0.437500 -0.500000 3.500000
+v -0.500000 -0.500000 3.500000
+v -0.500000 0.343750 -0.375000
+vt 0.062500 0.000000
+vt 0.062500 1.000000
+vt 0.000000 1.000000
+vt 0.000003 0.000000
+vt 0.937500 0.250000
+vt 1.000000 0.250000
+vt 1.000000 0.375000
+vt 0.937500 0.375000
+vt 0.625000 0.937500
+vt 0.625000 0.999999
+vt 0.562500 0.999999
+vt 0.562500 0.937500
+vt 0.937500 0.125000
+vt 1.000000 0.125000
+vt 0.687500 0.937500
+vt 0.687500 0.999999
+vt 0.937500 0.000000
+vt 1.000000 0.000000
+vt 0.062500 0.125000
+vt 0.000000 0.125000
+vt 0.875000 0.937500
+vt 0.875000 1.000000
+vt 0.812500 1.000000
+vt 0.812500 0.937500
+vt 0.843750 0.937500
+vt 0.062500 0.250000
+vt 0.000000 0.250000
+vt 0.937500 0.937500
+vt 0.937500 1.000000
+vt 0.062500 0.375000
+vt 0.000000 0.375000
+vt 1.000000 0.937500
+vt 1.000000 1.000000
+vt 0.437500 0.937500
+vt 0.437500 0.999999
+vt 0.375000 0.999999
+vt 0.375000 0.937500
+vt 0.312500 0.999999
+vt 0.312500 0.937500
+vt 0.187500 0.937500
+vt 0.187500 0.999999
+vt 0.125000 0.999999
+vt 0.125000 0.937500
+vt 0.062500 0.937500
+vt 0.000000 0.937500
+vt 0.625000 0.000000
+vt 0.625000 0.062500
+vt 0.625000 0.437500
+vt 0.625000 0.562500
+vt 0.375000 0.437500
+vt 0.375000 0.062500
+vt 0.375000 0.000000
+vt 0.375000 0.562500
+vt 0.250000 0.437500
+vt 0.250000 0.375000
+vt 0.250000 0.125000
+vt 0.250000 0.062500
+vt 0.250000 0.937500
+vt 0.250000 0.875000
+vt 0.250000 0.625000
+vt 0.250000 0.562500
+vt 0.750000 0.562500
+vt 0.750000 0.625000
+vt 0.750000 0.875000
+vt 0.750000 0.937500
+vt 0.750000 0.062500
+vt 0.750000 0.125000
+vt 0.750000 0.375000
+vt 0.750000 0.437500
+vt 0.875000 0.625000
+vt 0.875000 0.687500
+vt 0.875000 0.812500
+vt 0.875000 0.875000
+vt 0.875000 0.125000
+vt 0.875000 0.156250
+vt 0.875000 0.187500
+vt 0.875000 0.312500
+vt 0.875000 0.375000
+vt 1.000000 0.687500
+vt 1.000000 0.812500
+vt 1.000000 0.187500
+vt 1.000000 0.312500
+vt 0.125000 0.187500
+vt 0.125000 0.312500
+vt 0.000000 0.312500
+vt 0.000000 0.187500
+vt 0.125000 0.687500
+vt 0.125000 0.812500
+vt 0.000000 0.812500
+vt 0.000000 0.687500
+vt 0.125000 0.875000
+vt 0.125000 0.625000
+vt 0.125000 0.375000
+vt 0.125000 0.125000
+vn 0.000000 1.000000 0.000000
+vn -0.000000 -1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -1.000000 0.000000 0.000000
+vn 1.000000 -0.000000 -0.000000
+vn 0.000000 0.000000 1.000000
+g Cube_Cube_Material
+s off
+f 57/1/1 3/2/1 4/3/1 58/4/1
+f 31/5/2 30/6/2 32/7/2 33/8/2
+f 8/9/3 7/10/3 30/11/3 31/12/3
+f 9/13/2 10/14/2 7/6/2 8/5/2
+f 12/15/3 11/16/3 10/10/3 9/9/3
+f 24/17/2 25/18/2 11/14/2 12/13/2
+f 16/19/1 15/20/1 14/4/1 13/1/1
+f 17/21/3 18/22/3 15/23/3 16/24/3 69/25/3
+f 20/26/1 19/27/1 18/20/1 17/19/1
+f 26/28/3 27/29/3 19/22/3 20/21/3
+f 29/30/1 28/31/1 27/27/1 26/26/1
+f 1/32/3 2/33/3 28/29/3 29/28/3
+f 37/34/3 36/35/3 38/36/3 39/37/3
+f 39/26/1 38/27/1 40/20/1 41/19/1
+f 41/37/3 40/36/3 42/38/3 43/39/3
+f 22/17/2 23/18/2 46/14/2 45/13/2
+f 45/40/3 46/41/3 48/42/3 47/43/3
+f 47/13/2 48/14/2 50/6/2 49/5/2
+f 49/43/3 50/42/3 52/2/3 51/44/3
+f 51/5/2 52/6/2 54/7/2 53/8/2
+f 53/44/3 54/2/3 56/3/3 55/45/3
+f 43/19/1 42/20/1 21/4/1 44/1/1
+f 14/23/3 25/16/3 24/15/3 13/24/3
+f 60/18/2 5/33/2 6/29/2 59/17/2
+f 21/38/3 23/41/3 22/40/3 44/39/3
+f 57/18/4 59/33/4 6/3/4 3/4/4
+f 60/3/5 58/4/5 4/18/5 5/33/5
+f 1/30/1 57/2/1 58/3/1 2/31/1
+f 56/7/2 60/33/2 59/29/2 55/8/2
+f 1/46/4 29/47/4 33/48/4 35/49/4 53/9/4 55/10/4 59/3/4 57/4/4
+f 32/50/5 28/51/5 2/52/5 58/18/5 60/33/5 56/36/5 54/37/5 34/53/5
+f 34/31/1 36/27/1 37/26/1 35/30/1
+f 30/54/5 7/55/5 19/56/5 27/57/5 28/51/5 32/50/5
+f 34/53/5 54/37/5 52/58/5 50/59/5 38/60/5 36/61/5
+f 53/9/4 35/49/4 37/62/4 39/63/4 49/64/4 51/65/4
+f 29/47/4 26/66/4 20/67/4 8/68/4 31/69/4 33/48/4
+f 33/12/3 32/11/3 34/35/3 35/34/3
+f 3/1/1 61/2/1 62/3/1 4/4/1
+f 65/33/6 68/3/6 67/45/6 66/32/6
+f 5/18/2 63/33/2 64/29/2 6/17/2
+f 3/18/4 6/33/4 64/3/4 61/4/4
+f 5/3/5 4/4/5 62/18/5 63/33/5
+f 61/1/1 65/2/1 66/3/1 62/4/1
+f 63/18/2 67/33/2 68/29/2 64/17/2
+f 61/18/4 64/33/4 68/3/4 65/4/4
+f 63/3/5 62/4/5 66/18/5 67/33/5
+f 49/64/4 39/63/4 41/70/4 43/71/4 45/72/4 47/73/4
+f 8/68/4 20/67/4 17/74/4 69/75/4 16/76/4 12/77/4 9/78/4
+f 45/72/4 43/71/4 44/79/4 22/80/4
+f 12/77/4 16/76/4 13/81/4 24/82/4
+f 15/83/5 11/84/5 25/85/5 14/86/5
+f 42/87/5 46/88/5 23/89/5 21/90/5
+f 38/60/5 50/59/5 48/91/5 46/88/5 42/87/5 40/92/5
+f 7/55/5 10/93/5 11/84/5 15/83/5 18/94/5 19/56/5
diff --git a/castle/tapestry.lua b/castle/tapestry.lua
index 8b31bdc..4a90c93 100644
--- a/castle/tapestry.lua
+++ b/castle/tapestry.lua
@@ -2,7 +2,7 @@ local tapestry = {}
 
 minetest.register_node("castle:tapestry_top", {
 	drawtype = "nodebox",
- description = "Tapestry Top",
+	description = "Tapestry Top",
 	tiles = {"default_wood.png"},
 	sunlight_propagates = true,
 	groups = {flammable=3,oddly_breakable_by_hand=3},
@@ -30,163 +30,164 @@ minetest.register_craft({
 })
 
 tapestry.colours = {
-	{"white",      "White",      "white",    "#FFFFFF"},
-	{"grey",       "Grey",       "grey",    "#4B4B4B"},
-	{"black",      "Black",      "black",    "#1F1F1F"},
-	{"red",        "Red",        "red",    "#B21414"},
-	{"yellow",     "Yellow",     "yellow",    "#FFD011"},
- {"green",      "Green",      "green",    "#43A91C"},
-	{"cyan",       "Cyan",       "cyan",    "#00737B"},
-	{"blue",       "Blue",       "blue",    "#003A7E"},
-	{"magenta",    "Magenta",    "magenta",    "#DD0487"},
-	{"orange",     "Orange",     "orange",    "#D55014"},
-	{"violet",     "Violet",     "violet",    "#5D01AC"},
-	{"dark_grey",  "Dark Grey",  "dark_grey",    "#3A3A3A"},
-	{"dark_green", "Dark Green", "dark_green",    "#206400"},
-	{"pink", "Pink", "pink",    "#FF8383"},
-	{"brown", "Brown", "brown",    "#6D3800"},
+	"white",
+	"grey",
+	"black",
+	"red",
+	"yellow",
+	"green",
+	"cyan",
+	"blue",
+	"magenta",
+	"orange",
+	"violet",
+	"dark_grey",
+	"dark_green",
+	"pink",
+	"brown",
 }
 
-for _, row in ipairs(tapestry.colours) do
-	local name = row[1]
-	local desc = row[2]
-	local craft_color_group = row[3]
-	local defcolor = row[4]
-	-- Node Definition
-  minetest.register_node("castle:tapestry_"..name, {
-  drawtype = "nodebox",
-  description = desc.." Tapestry",
-  --uses default wool textures for tapestry material
-  tiles = {"wool_"..name..".png^[transformR90"},
-  --uses custom texture for tapestry material
-  --tiles = {"castle_tapestry_overlay.png^[colorize:" .. defcolor ..":205"},
-  groups = {oddly_breakable_by_hand=3,flammable=3},
-  sounds = default.node_sound_defaults(),
-  paramtype = "light",
-  paramtype2 = "facedir",
-  node_box = {
-  type = "fixed",
-  fixed = {
-			    {-0.3125,-0.5,0.4375,-0.1875,-0.375,0.5},
-			    {0.1875,-0.5,0.4375,0.3125,-0.375,0.5},
-			    {-0.375,-0.375,0.4375,-0.125,-0.25,0.5},
-			    {0.125,-0.375,0.4375,0.375,-0.25,0.5},
-			    {-0.4375,-0.25,0.4375,-0.0625,-0.125,0.5},
-			    {0.0625,-0.25,0.4375,0.4375,-0.125,0.5},
-			    {-0.5,-0.125,0.4375,0.0,0.0,0.5},
-			    {0.0,-0.125,0.4375,0.5,0.0,0.5},
-			    {-0.5,0.0,0.4375,0.5,1.5,0.5},
-		    },
-	    },
-	    selection_box = {
-		    type = "fixed",
-		    fixed = {
-			    {-0.5,-0.5,0.4375,0.5,1.5,0.5},
-		    },
-	    },
-	})
-	if craft_color_group then
-		-- Crafting from wool and a stick
-		minetest.register_craft({
-			type = "shapeless",
-			output = 'castle:tapestry_'..name,
-			recipe = {'wool:'..craft_color_group, 'default:stick'},
-		})
-	end
-end
+-- Regular-length tapestry
 
-for _, row in ipairs(tapestry.colours) do
-  local name = row[1]
-  local desc = row[2]
-  local craft_color_group = row[3]
-  local defcolor = row[4]
-  -- Node Definition
-  minetest.register_node("castle:long_tapestry_"..name, {
-  drawtype = "nodebox",
-  description = desc.." Tapestry (Long)",
-  --uses default wool textures for tapestry material
-  tiles = {"wool_"..name..".png^[transformR90"},
-  --uses custom texture for tapestry material
-  --tiles = {"castle_tapestry_overlay.png^[colorize:" .. defcolor ..":205"},
-  groups = {oddly_breakable_by_hand=3,flammable=3},
-  sounds = default.node_sound_defaults(),
-  paramtype = "light",
-  paramtype2 = "facedir",
-  node_box = {
-		    type = "fixed",
-		    fixed = {
-			    {-0.3125,-0.5,0.4375,-0.1875,-0.375,0.5},
-			    {0.1875,-0.5,0.4375,0.3125,-0.375,0.5},
-			    {-0.375,-0.375,0.4375,-0.125,-0.25,0.5},
-			    {0.125,-0.375,0.4375,0.375,-0.25,0.5},
-			    {-0.4375,-0.25,0.4375,-0.0625,-0.125,0.5},
-			    {0.0625,-0.25,0.4375,0.4375,-0.125,0.5},
-			    {-0.5,-0.125,0.4375,0.0,0.0,0.5},
-			    {0.0,-0.125,0.4375,0.5,0.0,0.5},
-			    {-0.5,0.0,0.4375,0.5,2.5,0.5},
-		    },
-	    },
-	    selection_box = {
-		    type = "fixed",
-		    fixed = {
-			    {-0.5,-0.5,0.4375,0.5,2.5,0.5},
-		    },
-	    },
-	})
-	if craft_color_group then
-		-- Crafting from normal tapestry and wool
-		minetest.register_craft({
-			type = "shapeless",
-			output = 'castle:long_tapestry_'..name,
-			recipe = {'wool:'..craft_color_group, 'castle:tapestry_'..name},
-		})
-	end
+minetest.register_node("castle:tapestry", {
+	drawtype = "mesh",
+	mesh = "castle_tapestry.obj",
+	description = "Tapestry",
+	tiles = {"castle_tapestry.png"},
+	inventory_image = "castle_tapestry_inv.png",
+	groups = {oddly_breakable_by_hand=3,flammable=3, ud_param2_colorable = 1},
+	sounds = default.node_sound_defaults(),
+	paramtype = "light",
+	paramtype2 = "colorwallmounted",
+	palette = "unifieddyes_palette_colorwallmounted.png",
+	selection_box = {
+		type = "wallmounted",
+		wall_side = {-0.5,-0.5,0.4375,0.5,1.5,0.5},
+	},
+	after_place_node = castle.fix_rotation_nsew,
+	after_dig_node = unifieddyes.after_dig_node
+})
+
+-- Crafting from wool and a stick
+
+minetest.register_craft({
+	type = "shapeless",
+	output = 'castle:tapestry',
+	recipe = {'wool:white', 'default:stick'},
+})
+
+-- Long tapestry
+
+minetest.register_node("castle:tapestry_long", {
+	drawtype = "mesh",
+	mesh = "castle_tapestry_long.obj",
+	description = "Tapestry (Long)",
+	tiles = {"castle_tapestry.png"},
+	inventory_image = "castle_tapestry_long_inv.png",
+	groups = {oddly_breakable_by_hand=3,flammable=3, ud_param2_colorable = 1},
+	sounds = default.node_sound_defaults(),
+	paramtype = "light",
+	paramtype2 = "colorwallmounted",
+	palette = "unifieddyes_palette_colorwallmounted.png",
+	selection_box = {
+		type = "wallmounted",
+		wall_side = {-0.5,-0.5,0.4375,0.5,2.5,0.5},
+	},
+	after_place_node = castle.fix_rotation_nsew,
+	after_dig_node = unifieddyes.after_dig_node
+})
+
+-- Crafting from normal tapestry and wool
+
+minetest.register_craft({
+	type = "shapeless",
+	output = 'castle:tapestry_long',
+	recipe = {'wool:white', 'castle:tapestry'},
+})
+
+-- Very long tapestry
+
+minetest.register_node("castle:tapestry_very_long", {
+	drawtype = "mesh",
+	mesh = "castle_tapestry_very_long.obj",
+	description = "Tapestry (Very Long)",
+	tiles = {"castle_tapestry.png"},
+	inventory_image = "castle_tapestry_very_long_inv.png",
+	groups = {oddly_breakable_by_hand=3,flammable=3, ud_param2_colorable = 1},
+	sounds = default.node_sound_defaults(),
+	paramtype = "light",
+	paramtype2 = "colorwallmounted",
+	palette = "unifieddyes_palette_colorwallmounted.png",
+	selection_box = {
+		type = "wallmounted",
+		wall_side = {-0.5,-0.5,0.4375,0.5,3.5,0.5},
+	},
+	after_place_node = castle.fix_rotation_nsew,
+	after_dig_node = unifieddyes.after_dig_node
+})
+
+-- Crafting from long tapestry and wool
+
+minetest.register_craft({
+	type = "shapeless",
+	output = 'castle:tapestry_very_long',
+	recipe = {'wool:white', 'castle:tapestry_long'},
+})
+
+-- Convert static tapestries to param2 color
+
+castle.old_static_tapestries = {}
+
+for _, color in ipairs(tapestry.colours) do
+	table.insert(castle.old_static_tapestries, "castle:tapestry_"..color)
+	table.insert(castle.old_static_tapestries, "castle:long_tapestry_"..color)
+	table.insert(castle.old_static_tapestries, "castle:very_long_tapestry_"..color)
 end
 
-for _, row in ipairs(tapestry.colours) do
-  local name = row[1]
-  local desc = row[2]
-  local craft_color_group = row[3]
- 	local defcolor = row[4]
-  -- Node Definition
-  minetest.register_node("castle:very_long_tapestry_"..name, {
-  drawtype = "nodebox",
-  description = desc.." Tapestry (Very Long)",
-  --uses default wool textures for tapestry material
-  tiles = {"wool_"..name..".png^[transformR90"},
-  --uses custom texture for tapestry material
-  --tiles = {"castle_tapestry_overlay.png^[colorize:" .. defcolor ..":205"},
-  groups = {oddly_breakable_by_hand=3,flammable=3},
-  sounds = default.node_sound_defaults(),
-  paramtype = "light",
-  paramtype2 = "facedir",
-  node_box = {
-  type = "fixed",
-  fixed = {
-			    {-0.3125,-0.5,0.4375,-0.1875,-0.375,0.5},
-			    {0.1875,-0.5,0.4375,0.3125,-0.375,0.5},
-			    {-0.375,-0.375,0.4375,-0.125,-0.25,0.5},
-			    {0.125,-0.375,0.4375,0.375,-0.25,0.5},
-			    {-0.4375,-0.25,0.4375,-0.0625,-0.125,0.5},
-			    {0.0625,-0.25,0.4375,0.4375,-0.125,0.5},
-			    {-0.5,-0.125,0.4375,0.0,0.0,0.5},
-			    {0.0,-0.125,0.4375,0.5,0.0,0.5},
-			    {-0.5,0.0,0.4375,0.5,3.5,0.5},
-		    },
-	    },
-	    selection_box = {
-		    type = "fixed",
-		    fixed = {
-			    {-0.5,-0.5,0.4375,0.5,3.5,0.5},
-		    },
-	    },
-	})
-	if craft_color_group then
-		-- Crafting from long tapestry and wool
-		minetest.register_craft({
-			type = "shapeless",
-			output = 'castle:very_long_tapestry_'..name,
-			recipe = {'wool:'..craft_color_group, 'castle:long_tapestry_'..name},
-		})
+minetest.register_lbm({
+	name = "castle:convert_tapestries",
+	label = "Convert tapestries to use param2 color",
+	run_at_every_load = true,
+	nodenames = castle.old_static_tapestries,
+	action = function(pos, node)
+		local oldname = node.name
+		local color = string.sub(oldname, string.find(oldname, "_", -12) + 1)
+
+		if color == "red" then
+			color = "medium_red"
+		elseif color == "cyan" then
+			color = "medium_cyan"
+		elseif color == "blue" then
+			color = "medium_blue"
+		elseif color == "magenta" then
+			color = "medium_magenta"
+		end
+
+		local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted")
+
+		local old_fdir = math.floor(node.param2 % 32)
+		local new_fdir = 3
+
+		if old_fdir == 0 then
+			new_fdir = 3
+		elseif old_fdir == 1 then
+			new_fdir = 4
+		elseif old_fdir == 2 then
+			new_fdir = 2
+		elseif old_fdir == 3 then
+			new_fdir = 5
+		end
+
+		local param2 = paletteidx + new_fdir
+		local newname = "castle:tapestry"
+		if string.find(oldname, ":long") then
+			newname = "castle:tapestry_long"
+		elseif string.find(oldname, ":very_long") then
+			newname = "castle:tapestry_very_long"
+		end
+
+		minetest.set_node(pos, { name = newname, param2 = param2 })
+		local meta = minetest.get_meta(pos)
+		meta:set_string("dye", "unifieddyes:"..color)
 	end
-end
+})
diff --git a/castle/textures/castle_tapestry.png b/castle/textures/castle_tapestry.png
new file mode 100644
index 0000000..e807340
Binary files /dev/null and b/castle/textures/castle_tapestry.png differ
diff --git a/castle/textures/castle_tapestry_inv.png b/castle/textures/castle_tapestry_inv.png
new file mode 100644
index 0000000..99c1b2e
Binary files /dev/null and b/castle/textures/castle_tapestry_inv.png differ
diff --git a/castle/textures/castle_tapestry_long_inv.png b/castle/textures/castle_tapestry_long_inv.png
new file mode 100644
index 0000000..ce04c40
Binary files /dev/null and b/castle/textures/castle_tapestry_long_inv.png differ
diff --git a/castle/textures/castle_tapestry_very_long_inv.png b/castle/textures/castle_tapestry_very_long_inv.png
new file mode 100644
index 0000000..6fcca22
Binary files /dev/null and b/castle/textures/castle_tapestry_very_long_inv.png differ
-- 
cgit v1.2.3