diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-06-26 19:23:44 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-06-26 19:23:44 +0300 |
commit | 5e3deed67232cfa67471536814fc0fd61e93011f (patch) | |
tree | 88356a44f933904e2cd8864f0b18be0987ac8c75 /src | |
parent | 97840e93b550f4436620f941dc088bb956ce13c8 (diff) | |
download | minetest-5e3deed67232cfa67471536814fc0fd61e93011f.tar.gz minetest-5e3deed67232cfa67471536814fc0fd61e93011f.tar.bz2 minetest-5e3deed67232cfa67471536814fc0fd61e93011f.zip |
Added CPT_FACEDIR_SIMPLE calculation, finally, as figured out by spongie
Diffstat (limited to 'src')
-rw-r--r-- | src/server.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp index 18357e19d..2ee94f345 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2734,9 +2734,31 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) MaterialItem *mitem = (MaterialItem*)item; MapNode n; n.d = mitem->getMaterial(); + + // Calculate direction for wall mounted stuff if(content_features(n.d).wall_mounted) n.dir = packDir(p_under - p_over); - + + // Calculate the direction for furnaces and chests and stuff + if(content_features(n.d).param_type == CPT_FACEDIR_SIMPLE) + { + v3f playerpos = player->getPosition(); + v3f blockpos = intToFloat(p_over, BS) - playerpos; + blockpos = blockpos.normalize(); + n.param1 = 0; + if (fabs(blockpos.X) > fabs(blockpos.Z)) { + if (blockpos.X < 0) + n.param1 = 3; + else + n.param1 = 1; + } else { + if (blockpos.Z < 0) + n.param1 = 2; + else + n.param1 = 0; + } + } + /* Send to all close-by players */ |