Preserve current fluid medium

This commit is contained in:
Ludvig Böklin 2021-04-24 18:40:28 +02:00
parent 7186569259
commit 23995b2ef1

View File

@ -863,11 +863,12 @@ impl<'a> PhysicsData<'a> {
depth,
vel: Vel::zero(),
})
.or_else(|| {
Some(Fluid::Air {
.or_else(|| match physics_state.in_fluid {
Some(Fluid::Water { .. }) => Some(Fluid::Air {
elevation: pos.0.z,
vel: Vel::zero(),
})
vel: Vel::default(),
}),
fluid => fluid,
});
tgt_pos = pos.0;
@ -1539,11 +1540,12 @@ fn box_voxel_collision<'a, T: BaseVol<Vox = Block> + ReadVol>(
depth,
vel: Vel::zero(),
})
.or_else(|| {
Some(Fluid::Air {
.or_else(|| match physics_state.in_fluid {
Some(Fluid::Water { .. }) => Some(Fluid::Air {
elevation: pos.0.z,
vel: Vel::zero(),
})
vel: Vel::default(),
}),
fluid => fluid,
});
}