}
bool getCollisionBox(aabb3f *toset) const { return false; }
+
+ virtual bool getSelectionBox(aabb3f *toset) const { return false; }
+
bool collideWithObjects() const { return false; }
private:
}
}
- if (getHP() == 0)
+ if (getHP() == 0) {
m_removed = true;
+ m_env->getScriptIface()->luaentity_on_death(m_id, puncher);
+ }
return false;
}
+bool LuaEntitySAO::getSelectionBox(aabb3f *toset) const
+{
+ if (!m_prop.is_visible) {
+ return false;
+ }
+
+ toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
+ toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;
+
+ return true;
+}
+
bool LuaEntitySAO::collideWithObjects() const
{
return m_prop.collideWithObjects;
m_prop.hp_max = PLAYER_MAX_HP;
m_prop.physical = false;
m_prop.weight = 75;
- m_prop.collisionbox = aabb3f(-0.3f, -1.0f, -0.3f, 0.3f, 0.75f, 0.3f);
+ m_prop.collisionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f);
// start of default appearance, this should be overwritten by LUA
m_prop.visual = "upright_sprite";
m_prop.visual_size = v2f(1, 2);
// end of default appearance
m_prop.is_visible = true;
m_prop.makes_footstep_sound = true;
+ m_prop.stepheight = PLAYER_DEFAULT_STEPHEIGHT * BS;
m_hp = PLAYER_MAX_HP;
}
os << serializeString(m_player->getName()); // name
writeU8(os, 1); // is_player
writeS16(os, getId()); //id
- writeV3F1000(os, m_base_position + v3f(0,BS*1,0));
+ writeV3F1000(os, m_base_position);
writeF1000(os, m_yaw);
writeS16(os, getHP());
if(isAttached()) // Just in case we ever do send attachment position too
pos = m_env->getActiveObject(m_attachment_parent_id)->getBasePosition();
else
- pos = m_base_position + v3f(0,BS*1,0);
+ pos = m_base_position;
std::string str = gob_cmd_update_position(
pos,
v3f(0,0,0),
bool PlayerSAO::getCollisionBox(aabb3f *toset) const
{
- *toset = aabb3f(-0.3f * BS, 0.0f, -0.3f * BS, 0.3f * BS, 1.75f * BS, 0.3f * BS);
+ //update collision box
+ toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
+ toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;
toset->MinEdge += m_base_position;
toset->MaxEdge += m_base_position;
return true;
}
+
+bool PlayerSAO::getSelectionBox(aabb3f *toset) const
+{
+ if (!m_prop.is_visible) {
+ return false;
+ }
+
+ getCollisionBox(toset);
+
+ return true;
+}