aboutsummaryrefslogtreecommitdiff
path: root/src/mapnode.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-04 11:18:14 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-04 11:18:14 +0300
commit9e683fff50ba4fef407613adf8407b31adca4596 (patch)
tree8dcb826fdaeeffbf6c5e781e59e22084c1bee736 /src/mapnode.cpp
parenta9f89fb3fb72a57828ebceaeb4b469a005c11541 (diff)
downloadminetest-9e683fff50ba4fef407613adf8407b31adca4596.tar.gz
minetest-9e683fff50ba4fef407613adf8407b31adca4596.tar.bz2
minetest-9e683fff50ba4fef407613adf8407b31adca4596.zip
initial chest metadata
Diffstat (limited to 'src/mapnode.cpp')
-rw-r--r--src/mapnode.cpp55
1 files changed, 47 insertions, 8 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index cb8bf7c42..f498d9e75 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -288,14 +288,6 @@ void init_mapnode()
f->wall_mounted = true;
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
- i = CONTENT_FURNACE;
- f = &g_content_features[i];
- f->setAllTextures("furnace_side.png");
- f->setTexture(2, "furnace_front.png");
- f->setInventoryTexture("furnace_front.png");
- f->param_type = CPT_NONE;
- f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
-
i = CONTENT_SIGN_WALL;
f = &g_content_features[i];
f->setInventoryTexture("sign_wall.png");
@@ -309,10 +301,57 @@ void init_mapnode()
if(f->initial_metadata == NULL)
f->initial_metadata = new SignNodeMetadata("Some sign");
+ i = CONTENT_CHEST;
+ f = &g_content_features[i];
+ f->param_type = CPT_FACEDIR_SIMPLE;
+ f->setAllTextures("chest_side.png");
+ f->setTexture(0, "chest_top.png");
+ f->setTexture(1, "chest_top.png");
+ f->setTexture(5, "chest_front.png"); // Z-
+ f->setInventoryTexture("chest_top.png");
+ //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
+ f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+ if(f->initial_metadata == NULL)
+ f->initial_metadata = new ChestNodeMetadata();
+
+ i = CONTENT_FURNACE;
+ f = &g_content_features[i];
+ f->param_type = CPT_FACEDIR_SIMPLE;
+ f->setAllTextures("furnace_side.png");
+ f->setTexture(5, "furnace_front.png"); // Z-
+ f->setInventoryTexture("furnace_front.png");
+ f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+
+}
+
+v3s16 facedir_rotate(u8 facedir, v3s16 dir)
+{
+ /*
+ Face 2 (normally Z-) direction:
+ facedir=0: Z-
+ facedir=1: X-
+ facedir=2: Z+
+ facedir=3: X+
+ */
+ v3s16 newdir;
+ if(facedir==0) // Same
+ newdir = v3s16(dir.X, dir.Y, dir.Z);
+ else if(facedir == 1) // Face is taken from rotXZccv(-90)
+ newdir = v3s16(-dir.Z, dir.Y, dir.X);
+ else if(facedir == 2) // Face is taken from rotXZccv(180)
+ newdir = v3s16(-dir.X, dir.Y, -dir.Z);
+ else if(facedir == 3) // Face is taken from rotXZccv(90)
+ newdir = v3s16(dir.Z, dir.Y, -dir.X);
+ else
+ newdir = dir;
+ return newdir;
}
TileSpec MapNode::getTile(v3s16 dir)
{
+ if(content_features(d).param_type == CPT_FACEDIR_SIMPLE)
+ dir = facedir_rotate(param1, dir);
+
TileSpec spec;
s32 dir_i = -1;