mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Refactored according to review
This commit is contained in:
parent
3adea9cdbb
commit
093b1c924c
@ -543,19 +543,16 @@ pub fn handle_delete(server: &mut Server, entity: EcsEntity) {
|
||||
pub fn handle_land_on_ground(server: &Server, entity: EcsEntity, vel: Vec3<f32>) {
|
||||
let ecs = server.state.ecs();
|
||||
|
||||
if vel.z <= -30.0 {
|
||||
// The second part of this if statement disables all fall damage when in the water. This was
|
||||
// added as a *temporary* fix a bug that causes you to take fall damage while swimming downwards.
|
||||
// FIXME: Fix the actual bug and remove the following relevant part of the if statement.
|
||||
if vel.z <= -30.0 && ecs
|
||||
.read_storage::<PhysicsState>()
|
||||
.get(entity)
|
||||
.map_or(true, |ps| ps.in_liquid().is_none())
|
||||
{
|
||||
let char_states = ecs.read_storage::<CharacterState>();
|
||||
|
||||
// This disables all fall damage when in the water by returning early. This was added as
|
||||
// a *temporary* fix a bug that causes you to take fall damage while swimming downwards.
|
||||
// FIXME: Fix the actual bug and remove the following if statement.
|
||||
if let Some(phys_data) = ecs.read_storage::<PhysicsState>().get(entity) {
|
||||
if phys_data.in_liquid().is_some() {
|
||||
debug!("Entity in liquid, skip fall damage calculations.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let reduced_vel_z = if let Some(CharacterState::DiveMelee(c)) = char_states.get(entity) {
|
||||
(vel.z + c.static_data.vertical_speed).min(0.0)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user