diff options
author | paramat <mat.gregory@virginmedia.com> | 2017-05-09 01:59:02 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-05-09 03:52:28 +0100 |
commit | da88a186766020762f5c86bc6ba1624e4feaae2c (patch) | |
tree | f8abbc09c17f951da1e768a963e9b0a68d7d8611 | |
parent | c07c642ab091b7250ecdc5defee1fec26ba73dc4 (diff) | |
download | minetest-da88a186766020762f5c86bc6ba1624e4feaae2c.tar.gz minetest-da88a186766020762f5c86bc6ba1624e4feaae2c.tar.bz2 minetest-da88a186766020762f5c86bc6ba1624e4feaae2c.zip |
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.
-rw-r--r-- | doc/lua_api.txt | 3 | ||||
-rw-r--r-- | src/constants.h | 6 | ||||
-rw-r--r-- | src/content_cao.cpp | 6 | ||||
-rw-r--r-- | src/content_cao.h | 6 | ||||
-rw-r--r-- | src/content_sao.cpp | 7 | ||||
-rw-r--r-- | src/localplayer.cpp | 4 | ||||
-rw-r--r-- | src/localplayer.h | 2 |
7 files changed, 4 insertions, 30 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d8e297f4c..901dd3c46 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -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", diff --git a/src/constants.h b/src/constants.h index 4079d0d8f..fb9e97cb3 100644 --- a/src/constants.h +++ b/src/constants.h @@ -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 diff --git a/src/content_cao.cpp b/src/content_cao.cpp index d0d3eb84f..4dde2bb7b 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -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 == "") diff --git a/src/content_cao.h b/src/content_cao.h index dde1dfe6f..3be753529 100644 --- a/src/content_cao.h +++ b/src/content_cao.h @@ -154,12 +154,6 @@ public: scene::IBillboardSceneNode *getSpriteSceneNode(); - - inline f32 getStepheight() const - { - return m_prop.stepheight; - } - inline bool isPlayer() const { return m_is_player; diff --git a/src/content_sao.cpp b/src/content_sao.cpp index f1a4df056..f435fe938 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -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; diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 20892dee6..b587f7bbb 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -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); diff --git a/src/localplayer.h b/src/localplayer.h index efea8bb86..9cbefae23 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -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); |