mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
New physics overrides (#11465)
This commit is contained in:
parent
2479d51cc6
commit
8ebaf753d3
8 changed files with 148 additions and 22 deletions
|
@ -325,6 +325,14 @@ std::string PlayerSAO::generateUpdatePhysicsOverrideCommand() const
|
|||
writeU8(os, !phys.sneak);
|
||||
writeU8(os, !phys.sneak_glitch);
|
||||
writeU8(os, !phys.new_move);
|
||||
// new physics overrides since 5.8.0
|
||||
writeF32(os, phys.speed_climb);
|
||||
writeF32(os, phys.speed_crouch);
|
||||
writeF32(os, phys.liquid_fluidity);
|
||||
writeF32(os, phys.liquid_fluidity_smooth);
|
||||
writeF32(os, phys.liquid_sink);
|
||||
writeF32(os, phys.acceleration_default);
|
||||
writeF32(os, phys.acceleration_air);
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
@ -609,17 +617,31 @@ bool PlayerSAO::checkMovementCheat()
|
|||
float player_max_walk = 0; // horizontal movement
|
||||
float player_max_jump = 0; // vertical upwards movement
|
||||
|
||||
if (m_privs.count("fast") != 0)
|
||||
player_max_walk = m_player->movement_speed_fast; // Fast speed
|
||||
else
|
||||
player_max_walk = m_player->movement_speed_walk; // Normal speed
|
||||
player_max_walk *= m_player->physics_override.speed;
|
||||
float speed_walk = m_player->movement_speed_walk * m_player->physics_override.speed;
|
||||
float speed_fast = m_player->movement_speed_fast;
|
||||
float speed_crouch = m_player->movement_speed_crouch * m_player->physics_override.speed_crouch;
|
||||
|
||||
// Get permissible max. speed
|
||||
if (m_privs.count("fast") != 0) {
|
||||
// Fast priv: Get the highest speed of fast, walk or crouch
|
||||
// (it is not forbidden the 'fast' speed is
|
||||
// not actually the fastest)
|
||||
player_max_walk = MYMAX(speed_crouch, speed_fast);
|
||||
player_max_walk = MYMAX(player_max_walk, speed_walk);
|
||||
} else {
|
||||
// Get the highest speed of walk or crouch
|
||||
// (it is not forbidden the 'walk' speed is
|
||||
// lower than the crouch speed)
|
||||
player_max_walk = MYMAX(speed_crouch, speed_walk);
|
||||
}
|
||||
|
||||
player_max_walk = MYMAX(player_max_walk, override_max_H);
|
||||
|
||||
player_max_jump = m_player->movement_speed_jump * m_player->physics_override.jump;
|
||||
// FIXME: Bouncy nodes cause practically unbound increase in Y speed,
|
||||
// until this can be verified correctly, tolerate higher jumping speeds
|
||||
player_max_jump *= 2.0;
|
||||
player_max_jump = MYMAX(player_max_jump, m_player->movement_speed_climb * m_player->physics_override.speed_climb);
|
||||
player_max_jump = MYMAX(player_max_jump, override_max_V);
|
||||
|
||||
// Don't divide by zero!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue