Revert custom player collision box and step height commits

These caused inability to pass through 2 node high spaces or step up onto slabs
or steps when a new client connected to an older server.
This commit is contained in:
paramat 2017-05-09 01:59:02 +01:00
parent c07c642ab0
commit da88a18676
7 changed files with 4 additions and 30 deletions

View File

@ -3705,9 +3705,6 @@ Definition tables
collide_with_objects = true, -- collide with other objects if physical = true
weight = 5,
collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
-- ^ For players (0, -1, 0) is at object base level,
-- for all other objects (0, 0, 0) is at object base level.
-- For example, Minetest Game player box is (-0.3, -1.0, -0.3, 0.3, 0.75, 0.3).
visual = "cube" / "sprite" / "upright_sprite" / "mesh" / "wielditem",
visual_size = {x = 1, y = 1},
mesh = "model",

View File

@ -90,12 +90,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// Maximum hit points of a player
#define PLAYER_MAX_HP 20
// Player weight
#define PLAYER_DEFAULT_WEIGHT 75
// Player step height
#define PLAYER_DEFAULT_STEPHEIGHT 0.6f
// Maximal breath of a player
#define PLAYER_MAX_BREATH 11

View File

@ -1586,13 +1586,7 @@ void GenericCAO::processMessage(const std::string &data)
}
if (m_is_local_player) {
LocalPlayer *player = m_env->getLocalPlayer();
player->makes_footstep_sound = m_prop.makes_footstep_sound;
aabb3f collisionbox = m_selection_box;
collisionbox.MinEdge += v3f(0, BS, 0);
collisionbox.MaxEdge += v3f(0, BS, 0);
player->setCollisionbox(collisionbox);
}
if ((m_is_player && !m_is_local_player) && m_prop.nametag == "")

View File

@ -154,12 +154,6 @@ public:
scene::IBillboardSceneNode *getSpriteSceneNode();
inline f32 getStepheight() const
{
return m_prop.stepheight;
}
inline bool isPlayer() const
{
return m_is_player;

View File

@ -797,7 +797,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, u16 peer_id
m_prop.hp_max = PLAYER_MAX_HP;
m_prop.physical = false;
m_prop.weight = PLAYER_DEFAULT_WEIGHT;
m_prop.weight = 75;
m_prop.collisionbox = aabb3f(-0.3f, -1.0f, -0.3f, 0.3f, 0.75f, 0.3f);
// start of default appearance, this should be overwritten by LUA
m_prop.visual = "upright_sprite";
@ -811,7 +811,6 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, u16 peer_id
// end of default appearance
m_prop.is_visible = true;
m_prop.makes_footstep_sound = true;
m_prop.stepheight = PLAYER_DEFAULT_STEPHEIGHT;
m_hp = PLAYER_MAX_HP;
}
@ -1429,9 +1428,7 @@ bool PlayerSAO::checkMovementCheat()
bool PlayerSAO::getCollisionBox(aabb3f *toset) const
{
//update collision box
toset->MinEdge = m_prop.collisionbox.MinEdge * BS + v3f(0, BS, 0);
toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS + v3f(0, BS, 0);
*toset = aabb3f(-0.3f * BS, 0.0f, -0.3f * BS, 0.3f * BS, 1.75f * BS, 0.3f * BS);
toset->MinEdge += m_base_position;
toset->MaxEdge += m_base_position;

View File

@ -344,8 +344,8 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
}
}
float player_stepheight = (m_cao == 0) ? 0.0f :
((touching_ground) ? m_cao->getStepheight() : (0.2f * BS));
// TODO: this shouldn't be hardcoded but transmitted from server
float player_stepheight = (touching_ground) ? (BS * 0.6f) : (BS * 0.2f);
#ifdef __ANDROID__
player_stepheight += (0.6f * BS);

View File

@ -137,8 +137,6 @@ public:
v3f getEyePosition() const { return m_position + getEyeOffset(); }
v3f getEyeOffset() const;
void setCollisionbox(aabb3f box) { m_collisionbox = box; }
private:
void accelerateHorizontal(const v3f &target_speed, const f32 max_increase);
void accelerateVertical(const v3f &target_speed, const f32 max_increase);