Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Autojump: Disable in fly mode, support continuous forward (#8200)
Correctly disable in fly mode (issue #8199)
Also autojump in continuous forward mode (issue #8201)
  • Loading branch information
SmallJoker committed Feb 9, 2019
1 parent 705b454 commit 6d6a813
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/client/localplayer.cpp
Expand Up @@ -611,6 +611,12 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
speedH += v3f(1,0,0) *
(control.sidew_move_joystick_axis / 32767.f);
}
if (m_autojump) {
// release autojump after a given time
m_autojump_time -= dtime;
if (m_autojump_time <= 0.0f)
m_autojump = false;
}
if(control.jump)
{
if (free_move) {
Expand Down Expand Up @@ -1102,17 +1108,12 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
if (!player_settings.autojump)
return;

if (m_autojump) {
// release autojump after a given time
m_autojump_time -= dtime;
if (m_autojump_time <= 0.0f)
m_autojump = false;
if (m_autojump)
return;
}

bool control_forward = control.up ||
(!control.up && !control.down &&
control.forw_move_joystick_axis < -0.05);
bool control_forward = control.up || player_settings.continuous_forward ||
(!control.up && !control.down &&
control.forw_move_joystick_axis < -0.05);
bool could_autojump =
m_can_jump && !control.jump && !control.sneak && control_forward;
if (!could_autojump)
Expand Down

0 comments on commit 6d6a813

Please sign in to comment.