aboutsummaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-08-06 03:57:34 +0100
committerparamat <mat.gregory@virginmedia.com>2017-08-09 11:06:22 +0100
commit3d0e8a691ff97a148f8c106bc23875df02226f9c (patch)
treef489270236bdf888652ddeb90609f83e760c0f64 /src/localplayer.cpp
parent7cd1251d83bd66a73fa7e9b676e6fe30e91e613a (diff)
downloadminetest-3d0e8a691ff97a148f8c106bc23875df02226f9c.tar.gz
minetest-3d0e8a691ff97a148f8c106bc23875df02226f9c.tar.bz2
minetest-3d0e8a691ff97a148f8c106bc23875df02226f9c.zip
Step height: Add as a player object property
Add settable player step height using the existing object property. Breaks compatibility with old clients, add to protocol version 35.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 0ab252a9d..f04be07d6 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -279,9 +279,15 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
// This should always apply, otherwise there are glitches
sanity_check(d > pos_max_d);
- // TODO: this shouldn't be hardcoded but transmitted from server
- float player_stepheight = (touching_ground) ? (BS * 0.6f) : (BS * 0.2f);
-
+ // Player object property step height is multiplied by BS in
+ // /src/script/common/c_content.cpp and /src/content_sao.cpp
+ float player_stepheight = (m_cao == nullptr) ? 0.0f :
+ (touching_ground ? m_cao->getStepHeight() : (0.2f * BS));
+
+ // TODO this is a problematic hack.
+ // Use a better implementation for autojump, or apply a custom stepheight
+ // to all players, as this currently creates unintended special movement
+ // abilities and advantages for Android players on a server.
#ifdef __ANDROID__
player_stepheight += (0.6f * BS);
#endif