aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/fparkan-runtime/src/lib.rs')
-rw-r--r--crates/fparkan-runtime/src/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs
index f7e73665..9a2b8a56 100644
--- a/crates/fparkan-runtime/src/lib.rs
+++ b/crates/fparkan-runtime/src/lib.rs
@@ -3009,6 +3009,10 @@ pub fn frame_with_player_motion(
pose.position = previous.position;
}
set_transform(&mut engine.world, cockpit.handle, pose)?;
+ let drowned = !blocked && player_motion::drowns(engine, cockpit, motion);
+ if drowned {
+ fparkan_world::request_delete(&mut engine.world, cockpit.handle)?;
+ }
let passenger = boarding::move_passenger(engine, cockpit, pose);
match frame(engine, queue_time_ms) {
Ok(mut frame) => {
@@ -3019,7 +3023,9 @@ pub fn frame_with_player_motion(
Ok(frame)
}
Err(error) => {
- set_transform(&mut engine.world, cockpit.handle, previous)?;
+ if !drowned {
+ set_transform(&mut engine.world, cockpit.handle, previous)?;
+ }
if let Some((handle, previous)) = passenger {
set_transform(&mut engine.world, handle, previous)?;
}