1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix glitch through ceiling with Sneak Glitch (#14332)

This commit is contained in:
sfence 2024-05-21 17:52:54 +02:00 committed by GitHub
parent 567f85752d
commit df8a600b22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 196 additions and 131 deletions

View file

@ -437,15 +437,18 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
m_speed.Z = 0.0f;
}
if (y_diff > 0 && m_speed.Y <= 0.0f &&
(physics_override.sneak_glitch || y_diff < BS * 0.6f)) {
if (y_diff > 0 && m_speed.Y <= 0.0f) {
// Move player to the maximal height when falling or when
// the ledge is climbed on the next step.
// Smoothen the movement (based on 'position.Y = bmax.Y')
position.Y += y_diff * dtime * 22.0f + BS * 0.01f;
position.Y = std::min(position.Y, bmax.Y);
m_speed.Y = 0.0f;
v3f check_pos = position;
check_pos.Y += y_diff * dtime * 22.0f + BS * 0.01f;
if (y_diff < BS * 0.6f || (physics_override.sneak_glitch
&& !collision_check_intersection(env, m_client, m_collisionbox, check_pos))) {
// Smoothen the movement (based on 'position.Y = bmax.Y')
position.Y = std::min(check_pos.Y, bmax.Y);
m_speed.Y = 0.0f;
}
}
// Allow jumping on node edges while sneaking