m_is_visible = false;
player->setCAO(this);
}
- if (m_client->getProtoVersion() < 33)
- m_env->addPlayerName(m_name);
}
}
m_yaw = readF1000(is);
m_hp = readS16(is);
num_messages = readU8(is);
- } else if (version == 0) { // In PROTOCOL_VERSION 13
- m_name = deSerializeString(is);
- m_is_player = readU8(is);
- m_position = readV3F1000(is);
- m_yaw = readF1000(is);
- m_hp = readS16(is);
- num_messages = readU8(is);
} else {
errorstream<<"GenericCAO: Unsupported init data version"
<<std::endl;
GenericCAO::~GenericCAO()
{
- if (m_is_player && m_client->getProtoVersion() < 33) {
- m_env->removePlayerName(m_name);
- }
removeFromScene(true);
}
bool GenericCAO::getSelectionBox(aabb3f *toset) const
{
if (!m_prop.is_visible || !m_is_visible || m_is_local_player
- || getParent() != NULL){
+ || !m_prop.pointable || getParent() != NULL) {
return false;
}
*toset = m_selection_box;
v3s16 GenericCAO::getLightPosition()
{
- return floatToInt(m_position + v3f(0, 0.5 * BS, 0), BS);
+ if (m_is_player)
+ return floatToInt(m_position + v3f(0, 0.5 * BS, 0), BS);
+
+ return floatToInt(m_position, BS);
}
void GenericCAO::updateNodePos()
if (cmd == GENERIC_CMD_SET_PROPERTIES) {
m_prop = gob_read_set_properties(is);
- m_selection_box = m_prop.collisionbox;
+ m_selection_box = m_prop.selectionbox;
m_selection_box.MinEdge *= BS;
m_selection_box.MaxEdge *= BS;
if (m_is_local_player) {
LocalPlayer *player = m_env->getLocalPlayer();
player->makes_footstep_sound = m_prop.makes_footstep_sound;
- player->setCollisionbox(m_selection_box);
+ aabb3f collision_box = m_prop.collisionbox;
+ collision_box.MinEdge *= BS;
+ collision_box.MaxEdge *= BS;
+ player->setCollisionbox(collision_box);
}
if ((m_is_player && !m_is_local_player) && m_prop.nametag.empty())