From 3d0e8a691ff97a148f8c106bc23875df02226f9c Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 6 Aug 2017 03:57:34 +0100 Subject: 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. --- src/localplayer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/localplayer.cpp') 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 -- cgit v1.2.3