Made fences stick to anything

This commit is contained in:
Joel Leclerc 2012-05-14 17:40:57 -06:00
parent 083d23d39d
commit e304ec13c4
2 changed files with 17 additions and 9 deletions

View File

@ -1342,7 +1342,8 @@ public:
//updateLegRot(dtime); //updateLegRot(dtime);
//updateNodePos(); //updateNodePos();
} }
else if(m_prop.visual == "cube"){ else if(m_prop.visual == "cube")
{
infostream<<"GenericCAO::addToScene(): cube"<<std::endl; infostream<<"GenericCAO::addToScene(): cube"<<std::endl;
scene::IMesh *mesh = createCubeMesh(v3f(BS,BS,BS)); scene::IMesh *mesh = createCubeMesh(v3f(BS,BS,BS));
m_meshnode = smgr->addMeshSceneNode(mesh, NULL); m_meshnode = smgr->addMeshSceneNode(mesh, NULL);
@ -1353,7 +1354,9 @@ public:
m_prop.visual_size.X)); m_prop.visual_size.X));
u8 li = m_last_light; u8 li = m_last_light;
setMeshColor(m_meshnode->getMesh(), video::SColor(255,li,li,li)); setMeshColor(m_meshnode->getMesh(), video::SColor(255,li,li,li));
} else if(m_prop.visual == "wielditem"){ }
else if(m_prop.visual == "wielditem")
{
infostream<<"GenericCAO::addToScene(): node"<<std::endl; infostream<<"GenericCAO::addToScene(): node"<<std::endl;
infostream<<"textures: "<<m_prop.textures.size()<<std::endl; infostream<<"textures: "<<m_prop.textures.size()<<std::endl;
if(m_prop.textures.size() >= 1){ if(m_prop.textures.size() >= 1){
@ -1391,13 +1394,16 @@ public:
updateTextures(""); updateTextures("");
scene::ISceneNode *node = NULL; scene::ISceneNode *node = NULL;
if(m_spritenode){ if(m_spritenode)
{
node = m_spritenode; node = m_spritenode;
} }
else if(m_meshnode){ else if(m_meshnode)
{
node = m_meshnode; node = m_meshnode;
} }
if(m_is_player && !m_is_local_player && (m_head || node)){ if(m_is_player && !m_is_local_player && (m_head || node))
{
// Add a text node for showing the name // Add a text node for showing the name
gui::IGUIEnvironment* gui = irr->getGUIEnvironment(); gui::IGUIEnvironment* gui = irr->getGUIEnvironment();
std::wstring wname = narrow_to_wide(m_name); std::wstring wname = narrow_to_wide(m_name);

View File

@ -675,7 +675,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
}; };
v3f move_torch(0,0,0); v3f move_torch(0,0,0);
int xyrotation = 0; int xyrotation = 180;
int yzrotation = 0; int yzrotation = 0;
for(s32 i=0; i<4; i++) for(s32 i=0; i<4; i++)
{ {
@ -880,7 +880,8 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
p2.X++; p2.X++;
MapNode n2 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p2); MapNode n2 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p2);
const ContentFeatures *f2 = &nodedef->get(n2); const ContentFeatures *f2 = &nodedef->get(n2);
if(f2->drawtype == NDT_FENCELIKE) //if(f2->drawtype == NDT_FENCELIKE)
if(f2->walkable)
{ {
aabb3f bar(-bar_len+BS/2,-bar_rad+BS/4,-bar_rad, aabb3f bar(-bar_len+BS/2,-bar_rad+BS/4,-bar_rad,
bar_len+BS/2,bar_rad+BS/4,bar_rad); bar_len+BS/2,bar_rad+BS/4,bar_rad);
@ -906,7 +907,8 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
p2.Z++; p2.Z++;
n2 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p2); n2 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p2);
f2 = &nodedef->get(n2); f2 = &nodedef->get(n2);
if(f2->drawtype == NDT_FENCELIKE) //if(f2->drawtype == NDT_FENCELIKE)
if(f2->walkable)
{ {
aabb3f bar(-bar_rad,-bar_rad+BS/4,-bar_len+BS/2, aabb3f bar(-bar_rad,-bar_rad+BS/4,-bar_len+BS/2,
bar_rad,bar_rad+BS/4,bar_len+BS/2); bar_rad,bar_rad+BS/4,bar_len+BS/2);