forked from oerkki/voxelands
remove CDT_WALLMOUNT and ContentFeatures wall_mounted - better to use nodeboxes and CPT_FACEDIR_WALLMOUNT
This commit is contained in:
parent
b3824cf626
commit
fc22d46b7d
|
@ -1107,63 +1107,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
collector.append(content_features(n).tiles[0].getMaterial(), &vertices[j], 4, indices, 6);
|
||||
}
|
||||
}
|
||||
/*
|
||||
Signs on walls
|
||||
*/
|
||||
break;
|
||||
case CDT_WALLMOUNT:
|
||||
{
|
||||
// Set material
|
||||
video::SMaterial material = content_features(n).tiles[0].getMaterial();
|
||||
material.setFlag(video::EMF_LIGHTING, false);
|
||||
material.setFlag(video::EMF_BACK_FACE_CULLING, false);
|
||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
material.setFlag(video::EMF_FOG_ENABLE, true);
|
||||
material.MaterialType
|
||||
= video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
//material.setTexture(0, pa_current->atlas);
|
||||
|
||||
u8 l = decode_light(n.getLightBlend(data->m_daynight_ratio));
|
||||
video::SColor c = MapBlock_LightColor(255, l);
|
||||
|
||||
float d = (float)BS/16;
|
||||
// Wall at X+ of node
|
||||
video::S3DVertex vertices[4] =
|
||||
{
|
||||
video::S3DVertex(BS/2-d,-BS/2,-BS/2, 0,0,0, c,
|
||||
content_features(n).tiles[0].texture.x0(), content_features(n).tiles[0].texture.y1()),
|
||||
video::S3DVertex(BS/2-d,-BS/2,BS/2, 0,0,0, c,
|
||||
content_features(n).tiles[0].texture.x1(), content_features(n).tiles[0].texture.y1()),
|
||||
video::S3DVertex(BS/2-d,BS/2,BS/2, 0,0,0, c,
|
||||
content_features(n).tiles[0].texture.x1(), content_features(n).tiles[0].texture.y0()),
|
||||
video::S3DVertex(BS/2-d,BS/2,-BS/2, 0,0,0, c,
|
||||
content_features(n).tiles[0].texture.x0(), content_features(n).tiles[0].texture.y0()),
|
||||
};
|
||||
|
||||
v3s16 dir = unpackDir(n.param2);
|
||||
|
||||
for(s32 i=0; i<4; i++)
|
||||
{
|
||||
if(dir == v3s16(1,0,0))
|
||||
vertices[i].Pos.rotateXZBy(0);
|
||||
if(dir == v3s16(-1,0,0))
|
||||
vertices[i].Pos.rotateXZBy(180);
|
||||
if(dir == v3s16(0,0,1))
|
||||
vertices[i].Pos.rotateXZBy(90);
|
||||
if(dir == v3s16(0,0,-1))
|
||||
vertices[i].Pos.rotateXZBy(-90);
|
||||
if(dir == v3s16(0,-1,0))
|
||||
vertices[i].Pos.rotateXYBy(-90);
|
||||
if(dir == v3s16(0,1,0))
|
||||
vertices[i].Pos.rotateXYBy(90);
|
||||
|
||||
vertices[i].Pos += intToFloat(p, BS);
|
||||
}
|
||||
|
||||
u16 indices[] = {0,1,2,2,3,0};
|
||||
// Add to mesh collector
|
||||
collector.append(content_features(n).tiles[0].getMaterial(), vertices, 4, indices, 6);
|
||||
}
|
||||
/*
|
||||
Add leaves if using new style
|
||||
*/
|
||||
|
|
|
@ -103,7 +103,7 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (n_from.getContent() == CONTENT_LADDER) {
|
||||
if (n_from.getContent() == CONTENT_LADDER_LEGACY) {
|
||||
switch (n_from.param2) {
|
||||
case 1:
|
||||
result.setContent(CONTENT_LADDER_WALL);
|
||||
|
@ -115,9 +115,11 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
|
|||
break;
|
||||
case 4:
|
||||
result.setContent(CONTENT_LADDER_ROOF);
|
||||
result.param2 = 0;
|
||||
break;
|
||||
case 8:
|
||||
result.setContent(CONTENT_LADDER_FLOOR);
|
||||
result.param2 = 0;
|
||||
break;
|
||||
case 16:
|
||||
result.setContent(CONTENT_LADDER_WALL);
|
||||
|
@ -130,6 +132,35 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
|
|||
default:;
|
||||
}
|
||||
}
|
||||
if (n_from.getContent() == CONTENT_TORCH_LEGACY) {
|
||||
switch (n_from.param2) {
|
||||
case 1:
|
||||
result.setContent(CONTENT_TORCH);
|
||||
result.param2 = 1;
|
||||
break;
|
||||
case 2:
|
||||
result.setContent(CONTENT_TORCH);
|
||||
result.param2 = 3;
|
||||
break;
|
||||
case 4:
|
||||
result.setContent(CONTENT_TORCH);
|
||||
result.param2 = 4;
|
||||
break;
|
||||
case 8:
|
||||
result.setContent(CONTENT_TORCH);
|
||||
result.param2 = 5;
|
||||
break;
|
||||
case 16:
|
||||
result.setContent(CONTENT_TORCH);
|
||||
result.param2 = 0;
|
||||
break;
|
||||
case 32:
|
||||
result.setContent(CONTENT_TORCH);
|
||||
result.param2 = 2;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
// stairs, slabs, gates, doors, and hatches were moved for 1311.00
|
||||
if (n_from.getContent() >= 0x826 && n_from.getContent() <= 0x87F) {
|
||||
// slabs
|
||||
|
@ -1912,30 +1943,40 @@ void content_mapnode_init()
|
|||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_LADDER;
|
||||
i = CONTENT_LADDER_LEGACY;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Ladder");
|
||||
f->setInventoryTexture("ladder-old.png");
|
||||
f->setAllTextures("ladder-old.png");
|
||||
f->setAllTextureFlags(0);
|
||||
f->setAllTextures("ladder.png");
|
||||
f->light_propagates = true;
|
||||
f->param_type = CPT_LIGHT;
|
||||
f->draw_type = CDT_WALLMOUNT;
|
||||
f->param2_type = CPT_FACEDIR_WALLMOUNT;
|
||||
f->draw_type = CDT_NODEBOX;
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem ")+itos(CONTENT_LADDER_WALL)+" 1";
|
||||
f->solidness = 0;
|
||||
f->floormount_alternate_node = CONTENT_LADDER_FLOOR;
|
||||
f->wallmount_alternate_node = CONTENT_LADDER_WALL;
|
||||
f->roofmount_alternate_node = CONTENT_LADDER_ROOF;
|
||||
f->wall_mounted = true;
|
||||
f->solidness = 0;
|
||||
f->air_equivalent = true;
|
||||
f->walkable = false;
|
||||
f->rotate_tile_with_nodebox = true;
|
||||
f->climbable = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->type = CMT_WOOD;
|
||||
f->hardness = 0.5;
|
||||
lists::add("creative",i);
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.4375*BS,-0.5*BS,0.3125*BS,-0.3125*BS,0.5*BS,0.5*BS
|
||||
));
|
||||
f->addNodeBox(core::aabbox3d<f32>(
|
||||
0.3125*BS,-0.5*BS,0.3125*BS,0.4375*BS,0.5*BS,0.5*BS
|
||||
));
|
||||
f->addNodeBox(core::aabbox3d<f32>(
|
||||
-0.3125*BS,-0.25*BS,0.375*BS,0.3125*BS,-0.1875*BS,0.4375*BS
|
||||
));
|
||||
f->addNodeBox(core::aabbox3d<f32>(
|
||||
-0.3125*BS,0.25*BS,0.375*BS,0.3125*BS,0.3125*BS,0.4375*BS
|
||||
));
|
||||
f->setInventoryTextureNodeBox(i,"ladder.png","ladder.png","ladder.png");
|
||||
|
||||
i = CONTENT_LADDER_WALL;
|
||||
f = &content_features(i);
|
||||
|
@ -1943,7 +1984,7 @@ void content_mapnode_init()
|
|||
f->setAllTextures("ladder.png");
|
||||
f->light_propagates = true;
|
||||
f->param_type = CPT_LIGHT;
|
||||
f->param2_type = CPT_FACEDIR_SIMPLE;
|
||||
f->param2_type = CPT_FACEDIR_WALLMOUNT;
|
||||
f->draw_type = CDT_NODEBOX;
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
|
||||
|
@ -1952,6 +1993,7 @@ void content_mapnode_init()
|
|||
f->roofmount_alternate_node = CONTENT_LADDER_ROOF;
|
||||
f->rotate_tile_with_nodebox = true;
|
||||
f->climbable = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->type = CMT_WOOD;
|
||||
|
@ -2009,6 +2051,7 @@ void content_mapnode_init()
|
|||
f->roofmount_alternate_node = CONTENT_LADDER_ROOF;
|
||||
f->rotate_tile_with_nodebox = true;
|
||||
f->climbable = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->type = CMT_WOOD;
|
||||
|
@ -2041,6 +2084,7 @@ void content_mapnode_init()
|
|||
f->wallmount_alternate_node = CONTENT_LADDER_WALL;
|
||||
f->rotate_tile_with_nodebox = true;
|
||||
f->climbable = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->type = CMT_WOOD;
|
||||
|
@ -4182,6 +4226,27 @@ void content_mapnode_init()
|
|||
f->post_effect_color = video::SColor(192, 255, 64, 0);
|
||||
#endif
|
||||
|
||||
i = CONTENT_TORCH_LEGACY;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Torch");
|
||||
f->setAllTextures("torch.png");
|
||||
f->setInventoryTexture("torch_inventory.png");
|
||||
f->setAllTextureFlags(0);
|
||||
f->param_type = CPT_LIGHT;
|
||||
f->param2_type = CPT_FACEDIR_WALLMOUNT;
|
||||
f->draw_type = CDT_TORCHLIKE;
|
||||
f->light_propagates = true;
|
||||
f->sunlight_propagates = true;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 0.5;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_TORCH)+" 1";
|
||||
f->light_source = LIGHT_MAX-1;
|
||||
f->type = CMT_WOOD;
|
||||
f->hardness = 0.0;
|
||||
|
||||
i = CONTENT_TORCH;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Torch");
|
||||
|
@ -4189,12 +4254,12 @@ void content_mapnode_init()
|
|||
f->setInventoryTexture("torch_inventory.png");
|
||||
f->setAllTextureFlags(0);
|
||||
f->param_type = CPT_LIGHT;
|
||||
f->param2_type = CPT_FACEDIR_WALLMOUNT;
|
||||
f->draw_type = CDT_TORCHLIKE;
|
||||
f->light_propagates = true;
|
||||
f->sunlight_propagates = true;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
f->wall_mounted = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 0.5;
|
||||
|
@ -4214,6 +4279,7 @@ void content_mapnode_init()
|
|||
f->setAllTextures("sign_wall.png");
|
||||
f->setInventoryTexture("sign_inventory.png");
|
||||
f->param_type = CPT_LIGHT;
|
||||
f->param2_type = CPT_FACEDIR_WALLMOUNT;
|
||||
f->draw_type = CDT_SIGNLIKE;
|
||||
f->light_propagates = true;
|
||||
f->sunlight_propagates = true;
|
||||
|
@ -4221,7 +4287,6 @@ void content_mapnode_init()
|
|||
f->roofmount_alternate_node = CONTENT_SIGN_UD;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
f->wall_mounted = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
|
@ -4290,6 +4355,7 @@ void content_mapnode_init()
|
|||
f->setAllTextures("sign_wall_lock.png");
|
||||
f->setInventoryTexture("sign_lock_inventory.png");
|
||||
f->param_type = CPT_LIGHT;
|
||||
f->param2_type = CPT_FACEDIR_WALLMOUNT;
|
||||
f->draw_type = CDT_SIGNLIKE;
|
||||
f->light_propagates = true;
|
||||
f->sunlight_propagates = true;
|
||||
|
@ -4297,7 +4363,6 @@ void content_mapnode_init()
|
|||
f->roofmount_alternate_node = CONTENT_LOCKABLE_SIGN_UD;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
f->wall_mounted = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
|
@ -7718,7 +7783,6 @@ void content_mapnode_init()
|
|||
f->sunlight_propagates = true;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
//f->wall_mounted = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
|
@ -7752,7 +7816,6 @@ void content_mapnode_init()
|
|||
f->sunlight_propagates = true;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
//f->wall_mounted = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
|
@ -7786,7 +7849,6 @@ void content_mapnode_init()
|
|||
f->sunlight_propagates = true;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
//f->wall_mounted = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
|
@ -7820,7 +7882,6 @@ void content_mapnode_init()
|
|||
f->sunlight_propagates = true;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
//f->wall_mounted = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
|
@ -7854,7 +7915,6 @@ void content_mapnode_init()
|
|||
f->sunlight_propagates = true;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->walkable = false;
|
||||
//f->wall_mounted = true;
|
||||
f->air_equivalent = true;
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
|
|
|
@ -41,10 +41,11 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
|||
#define CONTENT_STONE 0
|
||||
// FREE 1
|
||||
#define CONTENT_WATER 2
|
||||
#define CONTENT_TORCH 3
|
||||
#define CONTENT_TORCH_LEGACY 3
|
||||
#define CONTENT_GLASSLIGHT 4
|
||||
#define CONTENT_CHAIR 5
|
||||
// FREE 6-7
|
||||
// FREE 6
|
||||
#define CONTENT_TORCH 7
|
||||
#define CONTENT_TABLE 8
|
||||
#define CONTENT_WATERSOURCE 9
|
||||
// FREE 10-13
|
||||
|
@ -63,7 +64,7 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
|||
// FREE 26-29
|
||||
#define CONTENT_RAIL 30
|
||||
// deprecated, just here for backwards compat
|
||||
#define CONTENT_LADDER 31
|
||||
#define CONTENT_LADDER_LEGACY 31
|
||||
#define CONTENT_LAVA 32
|
||||
#define CONTENT_LAVASOURCE 33
|
||||
#define CONTENT_LADDER_WALL 34
|
||||
|
|
51
src/game.cpp
51
src/game.cpp
|
@ -487,57 +487,6 @@ void getPointedNode(Client *client, v3f player_position,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if(n.getContent() == CONTENT_LADDER)
|
||||
{
|
||||
v3s16 dir = unpackDir(n.param2);
|
||||
v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
|
||||
dir_f *= BS/2 - BS/6 - BS/20;
|
||||
v3f cpf = npf + dir_f;
|
||||
f32 distance = (cpf - camera_position).getLength();
|
||||
|
||||
v3f vertices[4] =
|
||||
{
|
||||
v3f(BS*0.42,-BS/2,-BS/2),
|
||||
v3f(BS*0.49, BS/2, BS/2),
|
||||
};
|
||||
|
||||
for (s32 i=0; i<2; i++) {
|
||||
if(dir == v3s16(1,0,0))
|
||||
vertices[i].rotateXZBy(0);
|
||||
if(dir == v3s16(-1,0,0))
|
||||
vertices[i].rotateXZBy(180);
|
||||
if(dir == v3s16(0,0,1))
|
||||
vertices[i].rotateXZBy(90);
|
||||
if(dir == v3s16(0,0,-1))
|
||||
vertices[i].rotateXZBy(-90);
|
||||
if(dir == v3s16(0,-1,0))
|
||||
vertices[i].rotateXYBy(-90);
|
||||
if(dir == v3s16(0,1,0))
|
||||
vertices[i].rotateXYBy(90);
|
||||
|
||||
vertices[i] += npf;
|
||||
}
|
||||
|
||||
core::aabbox3d<f32> box;
|
||||
|
||||
box = core::aabbox3d<f32>(vertices[0]);
|
||||
box.addInternalPoint(vertices[1]);
|
||||
|
||||
if(distance < mindistance)
|
||||
{
|
||||
if(box.intersectsWithLine(shootline))
|
||||
{
|
||||
nodefound = true;
|
||||
nodepos = np;
|
||||
neighbourpos = np;
|
||||
mindistance = distance;
|
||||
box.MinEdge -= intToFloat(camera_offset,BS);
|
||||
box.MaxEdge -= intToFloat(camera_offset,BS);
|
||||
nodehilightbox = box;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(n.getContent() == CONTENT_RAIL)
|
||||
{
|
||||
v3s16 dir = unpackDir(n.param0);
|
||||
|
|
|
@ -40,9 +40,15 @@ static std::vector<aabb3f> transformNodeBox(MapNode &n,
|
|||
{
|
||||
std::vector<aabb3f> boxes;
|
||||
int facedir = 0;
|
||||
if (content_features(n).param2_type == CPT_FACEDIR_SIMPLE) {
|
||||
if (
|
||||
content_features(n).param2_type == CPT_FACEDIR_SIMPLE
|
||||
|| content_features(n).param2_type == CPT_FACEDIR_WALLMOUNT
|
||||
) {
|
||||
facedir = n.param2&0x0F;
|
||||
}else if (content_features(n).param_type == CPT_FACEDIR_SIMPLE) {
|
||||
}else if (
|
||||
content_features(n).param_type == CPT_FACEDIR_SIMPLE
|
||||
|| content_features(n).param_type == CPT_FACEDIR_WALLMOUNT
|
||||
) {
|
||||
facedir = n.param1;
|
||||
}
|
||||
for(std::vector<aabb3f>::const_iterator
|
||||
|
@ -62,6 +68,14 @@ static std::vector<aabb3f> transformNodeBox(MapNode &n,
|
|||
box.MinEdge.rotateXZBy(90);
|
||||
box.MaxEdge.rotateXZBy(90);
|
||||
box.repair();
|
||||
}else if (facedir == 4) {
|
||||
box.MinEdge.rotateXYBy(-90);
|
||||
box.MaxEdge.rotateXYBy(-90);
|
||||
box.repair();
|
||||
}else if (facedir == 5) {
|
||||
box.MinEdge.rotateXYBy(90);
|
||||
box.MaxEdge.rotateXYBy(90);
|
||||
box.repair();
|
||||
}
|
||||
boxes.push_back(box);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,6 @@ enum ContentDrawType
|
|||
CDT_LIQUID,
|
||||
CDT_LIQUID_SOURCE,
|
||||
CDT_SIGNLIKE,
|
||||
CDT_WALLMOUNT,
|
||||
CDT_NODEBOX,
|
||||
CDT_GLASSLIKE,
|
||||
CDT_TORCHLIKE,
|
||||
|
@ -113,6 +112,7 @@ enum ContentParamType
|
|||
CPT_MINERAL,
|
||||
// Direction for chests and furnaces and such
|
||||
CPT_FACEDIR_SIMPLE,
|
||||
CPT_FACEDIR_WALLMOUNT,
|
||||
CPT_LIQUID
|
||||
};
|
||||
|
||||
|
@ -198,9 +198,6 @@ struct ContentFeatures
|
|||
bool jumpable;
|
||||
// Whether the node has no liquid, source liquid or flowing liquid
|
||||
enum LiquidType liquid_type;
|
||||
// If true, param2 is set to direction when placed. Used for torches.
|
||||
// NOTE: the direction format is quite inefficient and should be changed
|
||||
bool wall_mounted;
|
||||
// If true, node is equivalent to air. Torches are, air is. Water is not.
|
||||
// Is used for example to check whether a mud block can have grass on.
|
||||
bool air_equivalent;
|
||||
|
@ -298,7 +295,6 @@ struct ContentFeatures
|
|||
flammable = 0;
|
||||
jumpable = true;
|
||||
liquid_type = LIQUID_NONE;
|
||||
wall_mounted = false;
|
||||
air_equivalent = false;
|
||||
often_contains_mineral = false;
|
||||
dug_item = "";
|
||||
|
@ -535,21 +531,18 @@ u8 face_contents(content_t m1, content_t m2, bool *equivalent);
|
|||
inline u8 packDir(v3s16 dir)
|
||||
{
|
||||
u8 b = 0;
|
||||
|
||||
if(dir.X > 0)
|
||||
b |= (1<<0);
|
||||
else if(dir.X < 0)
|
||||
b |= (1<<1);
|
||||
|
||||
if(dir.Y > 0)
|
||||
b |= (1<<2);
|
||||
else if(dir.Y < 0)
|
||||
b |= (1<<3);
|
||||
|
||||
if(dir.Z > 0)
|
||||
b |= (1<<4);
|
||||
else if(dir.Z < 0)
|
||||
b |= (1<<5);
|
||||
if (dir.Y > 0)
|
||||
return 4;
|
||||
if (dir.Y < 0)
|
||||
return 5;
|
||||
if (dir.Z > 0)
|
||||
return 0;
|
||||
if (dir.X > 0)
|
||||
return 1;
|
||||
if (dir.Z < 0)
|
||||
return 2;
|
||||
if (dir.X < 0)
|
||||
return 3;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -557,26 +550,33 @@ inline v3s16 unpackDir(u8 b)
|
|||
{
|
||||
v3s16 d(0,0,0);
|
||||
|
||||
if(b & (1<<0))
|
||||
d.X = 1;
|
||||
else if(b & (1<<1))
|
||||
d.X = -1;
|
||||
|
||||
if(b & (1<<2))
|
||||
d.Y = 1;
|
||||
else if(b & (1<<3))
|
||||
d.Y = -1;
|
||||
|
||||
if(b & (1<<4))
|
||||
switch (b) {
|
||||
case 0:
|
||||
d.Z = 1;
|
||||
else if(b & (1<<5))
|
||||
break;
|
||||
case 1:
|
||||
d.X = 1;
|
||||
break;
|
||||
case 2:
|
||||
d.Z = -1;
|
||||
break;
|
||||
case 3:
|
||||
d.X = -1;
|
||||
break;
|
||||
case 4:
|
||||
d.Y = 1;
|
||||
break;
|
||||
case 5:
|
||||
d.Y = -1;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
/*
|
||||
facedir: CPT_FACEDIR_SIMPLE param1 value
|
||||
facedir: CPT_FACEDIR_SIMPLE param value
|
||||
dir: The face for which stuff is wanted
|
||||
return value: The face from which the stuff is actually found
|
||||
|
||||
|
|
|
@ -3531,11 +3531,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
n.setContent(content_features(n).wallmount_alternate_node);
|
||||
}
|
||||
|
||||
// Calculate direction for wall mounted stuff
|
||||
if(content_features(n).wall_mounted)
|
||||
n.param2 = packDir(p_under - p_over);
|
||||
|
||||
// Calculate the direction for furnaces and chests and stuff
|
||||
// Calculate the direction for directional and wall mounted nodes
|
||||
if (content_features(n).param2_type == CPT_FACEDIR_SIMPLE) {
|
||||
v3f playerpos = player->getPosition();
|
||||
v3f blockpos = intToFloat(p_over, BS) - playerpos;
|
||||
|
@ -3568,6 +3565,12 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
else
|
||||
n.param1 = 0;
|
||||
}
|
||||
}else if (content_features(n).param2_type == CPT_FACEDIR_WALLMOUNT) {
|
||||
n.param2 &= 0xF0;
|
||||
u8 pd = packDir(p_under - p_over);
|
||||
n.param2 |= (pd&0x0F);
|
||||
}else if (content_features(n).param_type == CPT_FACEDIR_WALLMOUNT) {
|
||||
n.param1 = packDir(p_under - p_over);
|
||||
}
|
||||
|
||||
core::list<u16> far_players;
|
||||
|
|
Loading…
Reference in New Issue