aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/lib.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 12:25:10 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 12:25:10 +0300
commit54b6e83f62fe52b221dcb7eebff245e9d5b39305 (patch)
treebacae515b98f0774e185a3777d4157fa22cc9c41 /crates/fparkan-runtime/src/lib.rs
parent8153f1d085c17a633bda68acb4cc01bbbc279615 (diff)
downloadfparkan-54b6e83f62fe52b221dcb7eebff245e9d5b39305.tar.xz
fparkan-54b6e83f62fe52b221dcb7eebff245e9d5b39305.zip
fix(player): drown on first supported step into water
Carry the terrain surface flags through the walking collision decision. A mesh floor over water remains safe. The first accepted wet step removes the hero and produces the normal mission failure event. Verified the surface flag in the original Control DLL and walked from the stock Constructor spawn to the lake in the Vulkan window.
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)?;
}