Revert custom player collision box and step height commits
authorparamat <mat.gregory@virginmedia.com>
Tue, 9 May 2017 00:59:02 +0000 (01:59 +0100)
committerparamat <mat.gregory@virginmedia.com>
Tue, 9 May 2017 02:52:28 +0000 (03:52 +0100)
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.

doc/lua_api.txt
src/constants.h
src/content_cao.cpp
src/content_cao.h
src/content_sao.cpp
src/localplayer.cpp
src/localplayer.h

index d8e297f4c659fb1e019a1ec585cffa9369d32f5c..901dd3c463e2b0cdf0cdc065ace6e16c595adfe7 100644 (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",
index 4079d0d8fb07964021dca527f0a336fa71280280..fb9e97cb3c09f3161fde756480a7e3b1e309432f 100644 (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
 
index d0d3eb84f8629fe08921edfa13c98422d5070987..4dde2bb7b8eca17a11ba4792f1e1237c9a6d9cd7 100644 (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 == "")
index dde1dfe6fd6868792b62a6b5e41cf80e1c4e5195..3be75352992eb8754a00770cb21ff912423f2882 100644 (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;
index f1a4df056044b3823434ce042234ce280f025f95..f435fe938296eae06bf5bff6589bde81d28aa389 100644 (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;
index 20892dee63001d1ecd83e03dffc75bd256cd663c..b587f7bbb3942dc3cc32a485a8e3dac73747bea3 100644 (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);
index efea8bb86294872dbe059da305a2889c57e48924..9cbefae2342eca71f940af1df138ea57ff5e5aae 100644 (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);