aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsavilli <78875209+savilli@users.noreply.github.com>2021-11-20 01:31:04 +0300
committerGitHub <noreply@github.com>2021-11-19 22:31:04 +0000
commitc9070e54bc5b3a99d941a3afd24d262f8925a962 (patch)
treef0271c40b0b125848134de1f51569c96696c1ad2 /src
parentc510037e9a334b3327a6d6b066203618051e4a09 (diff)
downloadminetest-c9070e54bc5b3a99d941a3afd24d262f8925a962.tar.gz
minetest-c9070e54bc5b3a99d941a3afd24d262f8925a962.tar.bz2
minetest-c9070e54bc5b3a99d941a3afd24d262f8925a962.zip
Fix local digging animation (#11772)
Diffstat (limited to 'src')
-rw-r--r--src/client/content_cao.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index 5c8465b22..bb78b594d 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -996,12 +996,14 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
m_velocity = v3f(0,0,0);
m_acceleration = v3f(0,0,0);
const PlayerControl &controls = player->getPlayerControl();
+ f32 new_speed = player->local_animation_speed;
bool walking = false;
- if (controls.movement_speed > 0.001f)
+ if (controls.movement_speed > 0.001f) {
+ new_speed *= controls.movement_speed;
walking = true;
+ }
- f32 new_speed = player->local_animation_speed;
v2s32 new_anim = v2s32(0,0);
bool allow_update = false;
@@ -1016,7 +1018,6 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
// slowdown speed if sneaking
if (controls.sneak && walking)
new_speed /= 2;
- new_speed *= controls.movement_speed;
if (walking && (controls.dig || controls.place)) {
new_anim = player->local_animations[3];