summaryrefslogtreecommitdiff
path: root/src/localplayer.h
diff options
context:
space:
mode:
authorBen Deutsch <ben@bendeutsch.de>2017-08-26 09:01:09 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-08-26 09:01:09 +0200
commitfc13c00ef3e9b6f280146f3d77b6659fcc55a13c (patch)
tree5e1a6712728694ef148a52d5f39ffce482feb77c /src/localplayer.h
parent0e0643df3567437b658431e9dad1e0eec2137a58 (diff)
downloadminetest-fc13c00ef3e9b6f280146f3d77b6659fcc55a13c.tar.gz
minetest-fc13c00ef3e9b6f280146f3d77b6659fcc55a13c.tar.bz2
minetest-fc13c00ef3e9b6f280146f3d77b6659fcc55a13c.zip
Alternative code for slipping (#6256)
* Alternative code for slipping - does not depend on frame rate - controllable via environment variables for now * Adjust slipping speed for item entities too. * Final version of framerate-independent slippery code * Remove dead code and fix formatting * getStandingNodePos should only look 0.05 nodes downwards This ensures that, even if the player is standing on a partially filled node, this node is used as the standing node and not the node below it. Specific use: enables slippery slabs * Exchange global getStandingPosNode change for local inline change Reverts previous commit * Revert the item movement changes * Slippery nodes now slip over cliffs and edges Players no longer suddenly stop before falling off. Also refactored slippery code into getSlipFactor method. * Slipping over an edge gated by player's is_slipping state A new flag for just this case, to reduce costly node lookups in the normal case of leaning over a non-slippery edge. Public access for consistency and potential future uses. * Minor code tweaks / cosmetics * Add temp variable to improve readability and fix indentation issues
Diffstat (limited to 'src/localplayer.h')
-rw-r--r--src/localplayer.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/localplayer.h b/src/localplayer.h
index c64e0042a..3521512af 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -60,6 +60,7 @@ public:
u8 liquid_viscosity = 0;
bool is_climbing = false;
bool swimming_vertical = false;
+ bool is_slipping = false;
float physics_override_speed = 1.0f;
float physics_override_jump = 1.0f;
@@ -143,11 +144,10 @@ public:
void setCollisionbox(const aabb3f &box) { m_collisionbox = box; }
private:
- // clang-format off
- void accelerateHorizontal(const v3f &target_speed, f32 max_increase, bool slippery);
- // clang-format on
+ void accelerateHorizontal(const v3f &target_speed, const f32 max_increase);
void accelerateVertical(const v3f &target_speed, const f32 max_increase);
bool updateSneakNode(Map *map, const v3f &position, const v3f &sneak_max);
+ float getSlipFactor(Environment *env, const v3f &speedH);
v3f m_position;