Accelerate player when holding jump key while bouncing

I hope this is better now.
The player jumps a bit higher everytime he holds jump key while bouncing of a bouncy block.
Previously if jump key was hold while bouncing only a jump with the high of normal jump was done, even if the player bounced much higher before.
Holding sneak key while landing on a trampoline still stops you bouncing and you sneak on the trampoline.

Please test with original jumping mod from here: https://github.com/Jeija/minetest-mod-jumping
Calinou's version has added disable_jump as a workaround for the bug in minetest and will not work right.
This commit is contained in:
Miner59 2015-07-11 13:10:07 +02:00
parent c2a9189965
commit d7a3b42430
1 changed files with 15 additions and 0 deletions

View File

@ -361,6 +361,21 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
m_can_jump = touching_ground && !in_liquid;
if(itemgroup_get(f.groups, "disable_jump"))
m_can_jump = false;
// Jump key pressed while jumping off from a bouncy block
if (m_can_jump && control.jump && itemgroup_get(f.groups, "bouncy") &&
m_speed.Y >= -0.5 * BS)
{
float jumpspeed = movement_speed_jump * physics_override_jump;
if (m_speed.Y > 1)
{
// Reduce boost when speed already is high
m_speed.Y += jumpspeed / (1 + (m_speed.Y / 16 ));
} else {
m_speed.Y += jumpspeed;
}
setSpeed(m_speed);
m_can_jump = false;
}
}
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d)