forked from oerkki/voxelands
make rooflike nodes climbable without jumping
This commit is contained in:
parent
fa1e0d3ced
commit
81e590f4e1
|
@ -2741,7 +2741,6 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
||||||
case 9:
|
case 9:
|
||||||
{
|
{
|
||||||
v3f cnr[5][3];
|
v3f cnr[5][3];
|
||||||
getRoofLights(blockpos_nodes+p,c,data,v3s16(0,1,0));
|
|
||||||
if (angle == 0) {
|
if (angle == 0) {
|
||||||
cnr[0][0] = v3f(-0.5,-0.5,-0.5);
|
cnr[0][0] = v3f(-0.5,-0.5,-0.5);
|
||||||
cnr[0][1] = v3f(0.5,-0.5,-0.5);
|
cnr[0][1] = v3f(0.5,-0.5,-0.5);
|
||||||
|
@ -2758,22 +2757,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
||||||
cnr[4][0] = v3f(0.5,-0.5,-0.5);
|
cnr[4][0] = v3f(0.5,-0.5,-0.5);
|
||||||
cnr[4][1] = v3f(0.5,-0.5,0.5);
|
cnr[4][1] = v3f(0.5,-0.5,0.5);
|
||||||
cnr[4][2] = v3f(0.,0.,0.);
|
cnr[4][2] = v3f(0.,0.,0.);
|
||||||
}else if (angle == 180) {
|
getRoofLights(blockpos_nodes+p,c,data,v3s16(1,1,0));
|
||||||
cnr[0][0] = v3f(-0.5,-0.5,-0.5);
|
|
||||||
cnr[0][1] = v3f(0.5,-0.5,-0.5);
|
|
||||||
cnr[0][2] = v3f(0.,0.,0.);
|
|
||||||
cnr[1][0] = v3f(0.5,-0.5,-0.5);
|
|
||||||
cnr[1][1] = v3f(0.,0.,0.);
|
|
||||||
cnr[1][2] = v3f(0.5,0.,0.);
|
|
||||||
cnr[2][0] = v3f(0.5,-0.5,0.5);
|
|
||||||
cnr[2][1] = v3f(-0.5,-0.5,0.5);
|
|
||||||
cnr[2][2] = v3f(0.,0.,0.);
|
|
||||||
cnr[3][0] = v3f(0.,0.,0.);
|
|
||||||
cnr[3][1] = v3f(0.5,-0.5,0.5);
|
|
||||||
cnr[3][2] = v3f(0.5,0.,0.);
|
|
||||||
cnr[4][0] = v3f(-0.5,-0.5,0.5);
|
|
||||||
cnr[4][1] = v3f(-0.5,-0.5,-0.5);
|
|
||||||
cnr[4][2] = v3f(0.,0.,0.);
|
|
||||||
}else if (angle == 90) {
|
}else if (angle == 90) {
|
||||||
cnr[0][0] = v3f(-0.5,-0.5,0.5);
|
cnr[0][0] = v3f(-0.5,-0.5,0.5);
|
||||||
cnr[0][1] = v3f(-0.5,-0.5,-0.5);
|
cnr[0][1] = v3f(-0.5,-0.5,-0.5);
|
||||||
|
@ -2790,6 +2774,24 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
||||||
cnr[4][0] = v3f(-0.5,-0.5,0.5);
|
cnr[4][0] = v3f(-0.5,-0.5,0.5);
|
||||||
cnr[4][1] = v3f(0.5,-0.5,0.5);
|
cnr[4][1] = v3f(0.5,-0.5,0.5);
|
||||||
cnr[4][2] = v3f(0.,0.,0.);
|
cnr[4][2] = v3f(0.,0.,0.);
|
||||||
|
getRoofLights(blockpos_nodes+p,c,data,v3s16(0,1,1));
|
||||||
|
}else if (angle == 180) {
|
||||||
|
cnr[0][0] = v3f(-0.5,-0.5,-0.5);
|
||||||
|
cnr[0][1] = v3f(0.5,-0.5,-0.5);
|
||||||
|
cnr[0][2] = v3f(0.,0.,0.);
|
||||||
|
cnr[1][0] = v3f(0.5,-0.5,-0.5);
|
||||||
|
cnr[1][1] = v3f(0.,0.,0.);
|
||||||
|
cnr[1][2] = v3f(0.5,0.,0.);
|
||||||
|
cnr[2][0] = v3f(0.5,-0.5,0.5);
|
||||||
|
cnr[2][1] = v3f(-0.5,-0.5,0.5);
|
||||||
|
cnr[2][2] = v3f(0.,0.,0.);
|
||||||
|
cnr[3][0] = v3f(0.,0.,0.);
|
||||||
|
cnr[3][1] = v3f(0.5,-0.5,0.5);
|
||||||
|
cnr[3][2] = v3f(0.5,0.,0.);
|
||||||
|
cnr[4][0] = v3f(-0.5,-0.5,0.5);
|
||||||
|
cnr[4][1] = v3f(-0.5,-0.5,-0.5);
|
||||||
|
cnr[4][2] = v3f(0.,0.,0.);
|
||||||
|
getRoofLights(blockpos_nodes+p,c,data,v3s16(-1,1,0));
|
||||||
}else if (angle == 270) {
|
}else if (angle == 270) {
|
||||||
cnr[0][0] = v3f(-0.5,-0.5,0.5);
|
cnr[0][0] = v3f(-0.5,-0.5,0.5);
|
||||||
cnr[0][1] = v3f(-0.5,-0.5,-0.5);
|
cnr[0][1] = v3f(-0.5,-0.5,-0.5);
|
||||||
|
@ -2806,6 +2808,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
||||||
cnr[4][0] = v3f(0.5,-0.5,-0.5);
|
cnr[4][0] = v3f(0.5,-0.5,-0.5);
|
||||||
cnr[4][1] = v3f(-0.5,-0.5,-0.5);
|
cnr[4][1] = v3f(-0.5,-0.5,-0.5);
|
||||||
cnr[4][2] = v3f(0.,0.,0.);
|
cnr[4][2] = v3f(0.,0.,0.);
|
||||||
|
getRoofLights(blockpos_nodes+p,c,data,v3s16(0,1,-1));
|
||||||
}
|
}
|
||||||
for (int s=0; s<5; s++) {
|
for (int s=0; s<5; s++) {
|
||||||
makeRoofTri(&collector,cnr[s],pos,&tile,1,c);
|
makeRoofTri(&collector,cnr[s],pos,&tile,1,c);
|
||||||
|
|
|
@ -1891,6 +1891,7 @@ void content_mapnode_init()
|
||||||
f->solidness = 0; // drawn separately, makes no faces
|
f->solidness = 0; // drawn separately, makes no faces
|
||||||
f->type = CMT_DIRT;
|
f->type = CMT_DIRT;
|
||||||
f->hardness = 0.75;
|
f->hardness = 0.75;
|
||||||
|
content_nodebox_roofcollide(f);
|
||||||
crafting::set1over4Recipe(CONTENT_TERRACOTTA,CONTENT_TERRACOTTA,CONTENT_ROOFTILE_TERRACOTTA);
|
crafting::set1over4Recipe(CONTENT_TERRACOTTA,CONTENT_TERRACOTTA,CONTENT_ROOFTILE_TERRACOTTA);
|
||||||
lists::add("craftguide",i);
|
lists::add("craftguide",i);
|
||||||
lists::add("creative",i);
|
lists::add("creative",i);
|
||||||
|
@ -1905,6 +1906,7 @@ void content_mapnode_init()
|
||||||
f->solidness = 0; // drawn separately, makes no faces
|
f->solidness = 0; // drawn separately, makes no faces
|
||||||
f->type = CMT_DIRT;
|
f->type = CMT_DIRT;
|
||||||
f->hardness = 0.75;
|
f->hardness = 0.75;
|
||||||
|
content_nodebox_roofcollide(f);
|
||||||
crafting::set1over4Recipe(CONTENT_WOOD,CONTENT_WOOD,CONTENT_ROOFTILE_WOOD);
|
crafting::set1over4Recipe(CONTENT_WOOD,CONTENT_WOOD,CONTENT_ROOFTILE_WOOD);
|
||||||
crafting::set1over4Recipe(CONTENT_JUNGLEWOOD,CONTENT_JUNGLEWOOD,CONTENT_ROOFTILE_WOOD);
|
crafting::set1over4Recipe(CONTENT_JUNGLEWOOD,CONTENT_JUNGLEWOOD,CONTENT_ROOFTILE_WOOD);
|
||||||
lists::add("craftguide",i);
|
lists::add("craftguide",i);
|
||||||
|
@ -1920,6 +1922,7 @@ void content_mapnode_init()
|
||||||
f->solidness = 0; // drawn separately, makes no faces
|
f->solidness = 0; // drawn separately, makes no faces
|
||||||
f->type = CMT_DIRT;
|
f->type = CMT_DIRT;
|
||||||
f->hardness = 0.75;
|
f->hardness = 0.75;
|
||||||
|
content_nodebox_roofcollide(f);
|
||||||
{
|
{
|
||||||
u16 r[9] = {
|
u16 r[9] = {
|
||||||
CONTENT_SAND, CONTENT_CRAFTITEM_PAPER, CONTENT_IGNORE,
|
CONTENT_SAND, CONTENT_CRAFTITEM_PAPER, CONTENT_IGNORE,
|
||||||
|
@ -1941,6 +1944,7 @@ void content_mapnode_init()
|
||||||
f->solidness = 0; // drawn separately, makes no faces
|
f->solidness = 0; // drawn separately, makes no faces
|
||||||
f->type = CMT_DIRT;
|
f->type = CMT_DIRT;
|
||||||
f->hardness = 0.75;
|
f->hardness = 0.75;
|
||||||
|
content_nodebox_roofcollide(f);
|
||||||
crafting::set1over4Recipe(CONTENT_ROUGHSTONE,CONTENT_ROUGHSTONE,CONTENT_ROOFTILE_STONE);
|
crafting::set1over4Recipe(CONTENT_ROUGHSTONE,CONTENT_ROUGHSTONE,CONTENT_ROOFTILE_STONE);
|
||||||
lists::add("craftguide",i);
|
lists::add("craftguide",i);
|
||||||
lists::add("creative",i);
|
lists::add("creative",i);
|
||||||
|
|
|
@ -1056,3 +1056,16 @@ void content_nodebox_jackolantern(ContentFeatures *f)
|
||||||
0.*BS,0.*BS,-0.5*BS,0.0625*BS,0.0625*BS,-0.4375*BS
|
0.*BS,0.*BS,-0.5*BS,0.0625*BS,0.0625*BS,-0.4375*BS
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void content_nodebox_roofcollide(ContentFeatures *f)
|
||||||
|
{
|
||||||
|
f->setNodeBox(core::aabbox3d<f32>(
|
||||||
|
-0.4375*BS,-0.5*BS,-0.4375*BS,0.4375*BS,-0.4375*BS,0.4375*BS
|
||||||
|
));
|
||||||
|
f->addNodeBox(core::aabbox3d<f32>(
|
||||||
|
-0.1875*BS,-0.3125*BS,-0.1875*BS,0.1875*BS,0.0625*BS,0.1875*BS
|
||||||
|
));
|
||||||
|
f->addNodeBox(core::aabbox3d<f32>(
|
||||||
|
-0.3125*BS,-0.4375*BS,-0.3125*BS,0.3125*BS,-0.3125*BS,0.3125*BS
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
|
@ -36,5 +36,6 @@ void content_nodebox_sign(ContentFeatures *f);
|
||||||
void content_nodebox_sign_ud(ContentFeatures *f);
|
void content_nodebox_sign_ud(ContentFeatures *f);
|
||||||
void content_nodebox_sign_wall(ContentFeatures *f);
|
void content_nodebox_sign_wall(ContentFeatures *f);
|
||||||
void content_nodebox_jackolantern(ContentFeatures *f);
|
void content_nodebox_jackolantern(ContentFeatures *f);
|
||||||
|
void content_nodebox_roofcollide(ContentFeatures *f);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
16
src/game.cpp
16
src/game.cpp
|
@ -387,8 +387,7 @@ void getPointedNode(Client *client, v3f player_position,
|
||||||
/*
|
/*
|
||||||
Meta-objects
|
Meta-objects
|
||||||
*/
|
*/
|
||||||
if(n.getContent() == CONTENT_TORCH)
|
if(n.getContent() == CONTENT_TORCH) {
|
||||||
{
|
|
||||||
v3s16 dir = unpackDir(n.param2);
|
v3s16 dir = unpackDir(n.param2);
|
||||||
v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
|
v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
|
||||||
dir_f *= BS/2 - BS/6 - BS/20;
|
dir_f *= BS/2 - BS/6 - BS/20;
|
||||||
|
@ -435,9 +434,7 @@ void getPointedNode(Client *client, v3f player_position,
|
||||||
nodehilightbox = box;
|
nodehilightbox = box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}else if(n.getContent() == CONTENT_RAIL) {
|
||||||
else if(n.getContent() == CONTENT_RAIL)
|
|
||||||
{
|
|
||||||
v3s16 dir = unpackDir(n.param0);
|
v3s16 dir = unpackDir(n.param0);
|
||||||
v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
|
v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
|
||||||
dir_f *= BS/2 - BS/6 - BS/20;
|
dir_f *= BS/2 - BS/6 - BS/20;
|
||||||
|
@ -474,11 +471,10 @@ void getPointedNode(Client *client, v3f player_position,
|
||||||
nodehilightbox = box;
|
nodehilightbox = box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
Node box
|
Roofs and Node boxes
|
||||||
*/
|
*/
|
||||||
else if (content_features(n).draw_type == CDT_NODEBOX) {
|
}else if (content_features(n).draw_type == CDT_NODEBOX) {
|
||||||
f32 distance = (npf - camera_position).getLength();
|
f32 distance = (npf - camera_position).getLength();
|
||||||
|
|
||||||
if (distance < mindistance) {
|
if (distance < mindistance) {
|
||||||
|
@ -552,9 +548,7 @@ void getPointedNode(Client *client, v3f player_position,
|
||||||
/*
|
/*
|
||||||
Regular blocks
|
Regular blocks
|
||||||
*/
|
*/
|
||||||
}
|
}else{
|
||||||
else
|
|
||||||
{
|
|
||||||
for(u16 i=0; i<6; i++)
|
for(u16 i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
v3f dir_f = v3f(dirs[i].X,
|
v3f dir_f = v3f(dirs[i].X,
|
||||||
|
|
Loading…
Reference in New Issue