mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Added CPT_FACEDIR_SIMPLE calculation, finally, as figured out by spongie
This commit is contained in:
parent
97840e93b5
commit
5e3deed672
@ -2734,9 +2734,31 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
MaterialItem *mitem = (MaterialItem*)item;
|
MaterialItem *mitem = (MaterialItem*)item;
|
||||||
MapNode n;
|
MapNode n;
|
||||||
n.d = mitem->getMaterial();
|
n.d = mitem->getMaterial();
|
||||||
|
|
||||||
|
// Calculate direction for wall mounted stuff
|
||||||
if(content_features(n.d).wall_mounted)
|
if(content_features(n.d).wall_mounted)
|
||||||
n.dir = packDir(p_under - p_over);
|
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
|
Send to all close-by players
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user