diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-03-16 13:41:17 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-16 13:41:17 -0500 |
| commit | b0bd992adcff71ee294dd05060e00e652f62a7b2 (patch) | |
| tree | 0a36d8b37befbc75c8c65cc2c8779c3df66bd87b /azalea-physics/src/lib.rs | |
| parent | a95408cbcc05b5bd04a084b0a286b571069206f6 (diff) | |
| download | azalea-drasl-b0bd992adcff71ee294dd05060e00e652f62a7b2.tar.xz | |
Fluid physics fixes (#210)
* start fixing code related to fluid physics
* implement force_solid for blocks
* afk pool test
Diffstat (limited to 'azalea-physics/src/lib.rs')
| -rw-r--r-- | azalea-physics/src/lib.rs | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs index 0541042c..2e8132c8 100644 --- a/azalea-physics/src/lib.rs +++ b/azalea-physics/src/lib.rs @@ -90,44 +90,40 @@ pub fn ai_step( physics.velocity.z = 0.; } - if let Some(jumping) = jumping { - if **jumping { - // TODO: jumping in liquids and jump delay - - let fluid_height = if physics.is_in_lava() { - physics.lava_fluid_height - } else if physics.is_in_water() { - physics.water_fluid_height - } else { - 0. - }; - - let in_water = physics.is_in_water() && fluid_height > 0.; - let fluid_jump_threshold = travel::fluid_jump_threshold(); - - if !in_water || physics.on_ground() && fluid_height <= fluid_jump_threshold { - if !physics.is_in_lava() - || physics.on_ground() && fluid_height <= fluid_jump_threshold + if jumping == Some(&Jumping(true)) { + let fluid_height = if physics.is_in_lava() { + physics.lava_fluid_height + } else if physics.is_in_water() { + physics.water_fluid_height + } else { + 0. + }; + + let in_water = physics.is_in_water() && fluid_height > 0.; + let fluid_jump_threshold = travel::fluid_jump_threshold(); + + if !in_water || physics.on_ground() && fluid_height <= fluid_jump_threshold { + if !physics.is_in_lava() + || physics.on_ground() && fluid_height <= fluid_jump_threshold + { + if (physics.on_ground() || in_water && fluid_height <= fluid_jump_threshold) + && physics.no_jump_delay == 0 { - if (physics.on_ground() || in_water && fluid_height <= fluid_jump_threshold) - && physics.no_jump_delay == 0 - { - jump_from_ground( - &mut physics, - position, - look_direction, - sprinting, - instance_name, - &instance_container, - ); - physics.no_jump_delay = 10; - } - } else { - jump_in_liquid(&mut physics); + jump_from_ground( + &mut physics, + position, + look_direction, + sprinting, + instance_name, + &instance_container, + ); + physics.no_jump_delay = 10; } } else { jump_in_liquid(&mut physics); } + } else { + jump_in_liquid(&mut physics); } } else { physics.no_jump_delay = 0; @@ -417,7 +413,6 @@ fn handle_relative_friction_and_calculate_movement( .unwrap_or_default() .into(); - // TODO: powdered snow if **on_climbable || block_at_feet == azalea_registry::Block::PowderSnow { physics.velocity.y = 0.2; } |
