nodebox drawing and collision bugfixes
This commit is contained in:
parent
3359eaf406
commit
a63b883d92
|
@ -779,6 +779,7 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->slab_cube_type = CONTENT_COBBLE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
|
@ -798,6 +799,7 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->slab_cube_type = CONTENT_MOSSYCOBBLE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
|
@ -817,6 +819,7 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->slab_cube_type = CONTENT_STONE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
|
@ -835,6 +838,7 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->slab_cube_type = CONTENT_WOOD;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
|
@ -854,6 +858,7 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
//f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->slab_cube_type = CONTENT_JUNGLETREE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
|
@ -873,6 +878,7 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("CraftItem clay_brick 4");
|
||||
f->slab_cube_type = CONTENT_BRICK;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
|
@ -892,6 +898,7 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAND)+" 4";
|
||||
f->slab_cube_type = CONTENT_SANDSTONE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
|
@ -911,7 +918,16 @@ void content_mapnode_init()
|
|||
f->draw_type = CDT_NODEBOX;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE_SLAB)+" 1";
|
||||
f->slab_cube_type = CONTENT_COBBLE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
0.,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS
|
||||
));
|
||||
setStoneLikeDiggingProperties(f->digging_properties, 0.9);
|
||||
|
||||
i = CONTENT_MOSSYCOBBLE_SLAB_UD;
|
||||
|
@ -922,7 +938,16 @@ void content_mapnode_init()
|
|||
f->draw_type = CDT_NODEBOX;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MOSSYCOBBLE_SLAB)+" 1";
|
||||
f->slab_cube_type = CONTENT_MOSSYCOBBLE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
0.,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS
|
||||
));
|
||||
setStoneLikeDiggingProperties(f->digging_properties, 0.8);
|
||||
|
||||
i = CONTENT_STONE_SLAB_UD;
|
||||
|
@ -933,7 +958,16 @@ void content_mapnode_init()
|
|||
f->draw_type = CDT_NODEBOX;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STONE_SLAB)+" 1";
|
||||
f->slab_cube_type = CONTENT_STONE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
0.,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS
|
||||
));
|
||||
setStoneLikeDiggingProperties(f->digging_properties, 1.0);
|
||||
|
||||
i = CONTENT_WOOD_SLAB_UD;
|
||||
|
@ -943,7 +977,16 @@ void content_mapnode_init()
|
|||
f->draw_type = CDT_NODEBOX;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_SLAB)+" 1";
|
||||
f->slab_cube_type = CONTENT_WOOD;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
0.,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS
|
||||
));
|
||||
setWoodLikeDiggingProperties(f->digging_properties, 0.75);
|
||||
|
||||
i = CONTENT_JUNGLE_SLAB_UD;
|
||||
|
@ -955,6 +998,15 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
//f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_JUNGLE_SLAB)+" 1";
|
||||
f->slab_cube_type = CONTENT_JUNGLETREE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
0.,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS
|
||||
));
|
||||
setWoodLikeDiggingProperties(f->digging_properties, 1.0);
|
||||
|
||||
i = CONTENT_BRICK_SLAB_UD;
|
||||
|
@ -966,6 +1018,15 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("CraftItem clay_brick 4");
|
||||
f->slab_cube_type = CONTENT_BRICK;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
0.,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS
|
||||
));
|
||||
setStoneLikeDiggingProperties(f->digging_properties, 1.0);
|
||||
|
||||
i = CONTENT_SANDSTONE_SLAB_UD;
|
||||
|
@ -977,6 +1038,15 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAND)+" 4";
|
||||
f->slab_cube_type = CONTENT_SANDSTONE;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
0.,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS
|
||||
));
|
||||
setDirtLikeDiggingProperties(f->digging_properties, 1.0);
|
||||
|
||||
// stairs
|
||||
|
@ -1185,6 +1255,22 @@ void content_mapnode_init()
|
|||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE_STAIR)+" 1";
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
0.,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS,
|
||||
0.5*BS
|
||||
));
|
||||
f->addNodeBox(core::aabbox3d<f32>(
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
-0.5*BS,
|
||||
0.5*BS,
|
||||
0.,
|
||||
0.
|
||||
));
|
||||
setStoneLikeDiggingProperties(f->digging_properties, 0.9);
|
||||
|
||||
i = CONTENT_MOSSYCOBBLE_STAIR_UD;
|
||||
|
|
|
@ -112,6 +112,11 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
|||
#define CONTENT_BRICK_STAIR 0x82d
|
||||
#define CONTENT_SANDSTONE_STAIR 0x82e
|
||||
|
||||
#define CONTENT_SLAB_MASK 0x827
|
||||
#define CONTENT_SLAB_STAIR_MIN 0x821
|
||||
#define CONTENT_SLAB_STAIR_MAX 0x82F
|
||||
#define CONTENT_SLAB_STAIR_FLIP 0x010
|
||||
|
||||
// upside down slabs
|
||||
#define CONTENT_COBBLE_SLAB_UD 0x831
|
||||
#define CONTENT_MOSSYCOBBLE_SLAB_UD 0x832
|
||||
|
@ -130,5 +135,8 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
|||
#define CONTENT_BRICK_STAIR_UD 0x83d
|
||||
#define CONTENT_SANDSTONE_STAIR_UD 0x83e
|
||||
|
||||
#define CONTENT_SLAB_STAIR_UD_MIN 0x831
|
||||
#define CONTENT_SLAB_STAIR_UD_MAX 0x83F
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -188,6 +188,9 @@ struct ContentFeatures
|
|||
// Mineral overrides this.
|
||||
std::string dug_item;
|
||||
|
||||
// When two slabs are joined into a cube, they make this
|
||||
content_t slab_cube_type;
|
||||
|
||||
// Extra dug item and its rarity
|
||||
std::string extra_dug_item;
|
||||
s32 extra_dug_item_rarity;
|
||||
|
@ -252,6 +255,7 @@ struct ContentFeatures
|
|||
air_equivalent = false;
|
||||
often_contains_mineral = false;
|
||||
dug_item = "";
|
||||
slab_cube_type = CONTENT_IGNORE;
|
||||
initial_metadata = NULL;
|
||||
liquid_alternative_flowing = CONTENT_IGNORE;
|
||||
liquid_alternative_source = CONTENT_IGNORE;
|
||||
|
|
|
@ -338,11 +338,11 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
|
|||
/*
|
||||
Calculate new position
|
||||
*/
|
||||
position += m_speed * dtime/2;
|
||||
|
||||
// Skip collision detection if a special movement mode is used
|
||||
bool free_move = g_settings->getBool("free_move");
|
||||
if (free_move) {
|
||||
position += m_speed * dtime;
|
||||
setPosition(position);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2735,6 +2735,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
else if(action == 1)
|
||||
{
|
||||
|
||||
v3s16 p_dir = p_under - p_over;
|
||||
InventoryList *ilist = player->inventory.getList("main");
|
||||
if(ilist == NULL)
|
||||
return;
|
||||
|
@ -2839,6 +2840,19 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
if(content_features(n).wall_mounted)
|
||||
n.param2 = packDir(p_under - p_over);
|
||||
|
||||
// Stairs and Slabs special functions
|
||||
if (n.getContent() >= CONTENT_SLAB_STAIR_MIN && n.getContent() <= CONTENT_SLAB_STAIR_UD_MAX) {
|
||||
MapNode abv = m_env.getMap().getNodeNoEx(p_over+p_dir);
|
||||
// Make a cube is two slabs of the same type are stacked on each other
|
||||
if (content_features(n).slab_cube_type != CONTENT_IGNORE && content_features(n).slab_cube_type == content_features(abv).slab_cube_type) {
|
||||
n.setContent(content_features(n).slab_cube_type);
|
||||
p_over += p_dir;
|
||||
// Flip it upside down if it's being placed on the roof
|
||||
}else if (p_dir.Y == 1) {
|
||||
n.setContent(n.getContent()|CONTENT_SLAB_STAIR_FLIP);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the direction for furnaces and chests and stuff
|
||||
if(content_features(n).param_type == CPT_FACEDIR_SIMPLE)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue