New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New jumping behavior controlled by physics override #9980
Changes from 4 commits
1c13922
a2c35bc
c1fccda
13333fa
98b8364
8872636
e64ee0f
ebee54a
b984c99
2de9dfd
385257f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6092,6 +6092,9 @@ object you are working with still exists. | |
(default: `false`) | ||
* `new_move`: use new move/sneak code. When `false` the exact old code | ||
is used for the specific old sneak behaviour (default: `true`) | ||
* `new_jump`: use the new jump/bouncy jump code. When `false` the exact | ||
old code is used for jumping and bouncy jumping behavior. | ||
(default: `true`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be false by default? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this rather be a float for jump "floatiness"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds like too much configurability that most people won't need. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm actually kinda weirded out why such a thing would be optional, that's one of the first annoying things I found about Minetest and it's the way jumping works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to make it false by default |
||
* `get_physics_override()`: returns the table given to `set_physics_override` | ||
* `hud_add(hud definition)`: add a HUD element described by HUD def, returns ID | ||
number on success | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -444,8 +444,9 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d, | |
m_can_jump = ((touching_ground && !is_climbing) || sneak_can_jump) && !m_disable_jump; | ||
|
||
// 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.5f * BS) { | ||
if ((!physics_override_new_jump && m_can_jump && control.jump && itemgroup_get(f.groups, "bouncy") && m_speed.Y >= -0.5f * BS)|| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The options common to both new & old jump should be moved into a variable for readability. |
||
(physics_override_new_jump && control.jump && itemgroup_get(f.groups, "bouncy") && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh it's very intentional, it's because m_can_jump is broken with bouncy nodes, and this creates a sane way to calculate if the player can jump based on their Y speed |
||
m_speed.Y >= -0.5f * BS && m_speed.Y <= itemgroup_get(f.groups, "bouncy"))) { | ||
float jumpspeed = movement_speed_jump * physics_override_jump; | ||
if (m_speed.Y > 1.0f) { | ||
// Reduce boost when speed already is high | ||
|
@@ -609,7 +610,8 @@ void LocalPlayer::applyControl(float dtime, Environment *env) | |
at its starting value | ||
*/ | ||
v3f speedJ = getSpeed(); | ||
if (speedJ.Y >= -0.5f * BS) { | ||
if ((!physics_override_new_jump && speedJ.Y >= -0.5f * BS) || | ||
(physics_override_new_jump && touching_ground && speedJ.Y >= -0.5f * BS && speedJ.Y <= 0.5f * BS)) { | ||
sfan5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
speedJ.Y = movement_speed_jump * physics_override_jump; | ||
setSpeed(speedJ); | ||
m_client->getEventManager()->put(new SimpleTriggerEvent(MtEvent::PLAYER_JUMP)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jump/bouncy jump? I don't think this was intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was, you can now continuously jump on bouncy nodes