summaryrefslogtreecommitdiff
path: root/src/content_cao.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-04-04 13:16:09 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-04-04 13:16:09 +0300
commitb22168d3da597d61c40cc93dd690ba143fd5e4cc (patch)
tree8a0e13767f6761a35c4dd7eaa2f6b38ac6246483 /src/content_cao.cpp
parentb9b56bac6bf5a9701c2898d254a2df9cdf99425c (diff)
downloadminetest-b22168d3da597d61c40cc93dd690ba143fd5e4cc.tar.gz
minetest-b22168d3da597d61c40cc93dd690ba143fd5e4cc.tar.bz2
minetest-b22168d3da597d61c40cc93dd690ba143fd5e4cc.zip
Fix dropped nodeitem visuals
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r--src/content_cao.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index 1241e0002..f211ff8b9 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -781,9 +781,27 @@ public:
m_meshnode = smgr->addMeshSceneNode(mesh, NULL);
mesh->drop();
- m_meshnode->setScale(v3f(1));
+ m_meshnode->setScale(v3f(m_prop.visual_size.X/2,
+ m_prop.visual_size.Y/2,
+ m_prop.visual_size.X/2));
u8 li = m_last_light;
setMeshColor(m_meshnode->getMesh(), video::SColor(255,li,li,li));
+ } else if(m_prop.visual == "wielditem"){
+ infostream<<"GenericCAO::addToScene(): node"<<std::endl;
+ infostream<<"textures: "<<m_prop.textures.size()<<std::endl;
+ if(m_prop.textures.size() >= 1){
+ infostream<<"textures[0]: "<<m_prop.textures[0]<<std::endl;
+ IItemDefManager *idef = m_gamedef->idef();
+ ItemStack item(m_prop.textures[0], 1, 0, "", idef);
+ scene::IMesh *mesh = item.getDefinition(idef).wield_mesh;
+ m_meshnode = smgr->addMeshSceneNode(mesh, NULL);
+
+ m_meshnode->setScale(v3f(m_prop.visual_size.X/2,
+ m_prop.visual_size.Y/2,
+ m_prop.visual_size.X/2));
+ u8 li = m_last_light;
+ setMeshColor(m_meshnode->getMesh(), video::SColor(255,li,li,li));
+ }
} else {
infostream<<"GenericCAO::addToScene(): \""<<m_prop.visual
<<"\" not supported"<<std::endl;
@@ -916,6 +934,10 @@ public:
updateTextures("");
}
}
+ if(fabs(m_prop.automatic_rotate > 0.001)){
+ m_yaw += dtime * m_prop.automatic_rotate * 180 / PI;
+ updateNodePos();
+ }
}
void updateTexturePos()
@@ -1064,7 +1086,8 @@ public:
m_position = readV3F1000(is);
m_velocity = readV3F1000(is);
m_acceleration = readV3F1000(is);
- m_yaw = readF1000(is);
+ if(fabs(m_prop.automatic_rotate < 0.001))
+ m_yaw = readF1000(is);
bool do_interpolate = readU8(is);
bool is_end_position = readU8(is);
float update_interval = readF1000(is);