mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix player teleportation bug whilst sneaking
Only set back position when sneaking if player wasn't teleported by adding and using a bool "got_teleported" to player it fixes #2876
This commit is contained in:
parent
5a40a7dad8
commit
c0b6986e38
4 changed files with 7 additions and 1 deletions
|
@ -183,7 +183,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
*/
|
||||
if (control.sneak && m_sneak_node_exists &&
|
||||
!(fly_allowed && g_settings->getBool("free_move")) && !in_liquid &&
|
||||
physics_override_sneak) {
|
||||
physics_override_sneak && !got_teleported) {
|
||||
f32 maxd = 0.5 * BS + sneak_max;
|
||||
v3f lwn_f = intToFloat(m_sneak_node, BS);
|
||||
position.X = rangelim(position.X, lwn_f.X-maxd, lwn_f.X+maxd);
|
||||
|
@ -204,6 +204,9 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
}
|
||||
}
|
||||
|
||||
if (got_teleported)
|
||||
got_teleported = false;
|
||||
|
||||
// this shouldn't be hardcoded but transmitted from server
|
||||
float player_stepheight = touching_ground ? (BS*0.6) : (BS*0.2);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue