Make autoforward simulate the 'up' key (#8249)

This commit is contained in:
DS 2019-05-21 20:50:00 +02:00 committed by Paramat
parent a90f2efb12
commit 9d09c87f13
2 changed files with 8 additions and 11 deletions

@ -2483,6 +2483,12 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
keypress_bits |= 1U << 4; keypress_bits |= 1U << 4;
} }
// autoforward if set: simulate "up" key
if (player->getPlayerSettings().continuous_forward) {
control.up = true;
keypress_bits |= 1U << 0;
}
client->setPlayerControl(control); client->setPlayerControl(control);
player->keyPressed = keypress_bits; player->keyPressed = keypress_bits;

@ -496,7 +496,6 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
bool pitch_move = (free_move || in_liquid) && player_settings.pitch_move; bool pitch_move = (free_move || in_liquid) && player_settings.pitch_move;
// When aux1_descends is enabled the fast key is used to go down, so fast isn't possible // When aux1_descends is enabled the fast key is used to go down, so fast isn't possible
bool fast_climb = fast_move && control.aux1 && !player_settings.aux1_descends; bool fast_climb = fast_move && control.aux1 && !player_settings.aux1_descends;
bool continuous_forward = player_settings.continuous_forward;
bool always_fly_fast = player_settings.always_fly_fast; bool always_fly_fast = player_settings.always_fly_fast;
// Whether superspeed mode is used or not // Whether superspeed mode is used or not
@ -583,17 +582,9 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
} }
} }
if (continuous_forward)
speedH += v3f(0,0,1);
if (control.up) { if (control.up) {
if (continuous_forward) {
if (fast_move)
superspeed = true;
} else {
speedH += v3f(0,0,1); speedH += v3f(0,0,1);
} }
}
if (control.down) { if (control.down) {
speedH -= v3f(0,0,1); speedH -= v3f(0,0,1);
} }
@ -1111,7 +1102,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
if (m_autojump) if (m_autojump)
return; return;
bool control_forward = control.up || player_settings.continuous_forward || bool control_forward = control.up ||
(!control.up && !control.down && (!control.up && !control.down &&
control.forw_move_joystick_axis < -0.05); control.forw_move_joystick_axis < -0.05);
bool could_autojump = bool could_autojump =