aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/player_motion.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 15:08:21 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 15:08:21 +0300
commit3caf781850682fbf04958f70636471e546f0d426 (patch)
tree746ddf4686c3952ec33d9ab2940eadbebecc6801 /crates/fparkan-runtime/src/player_motion.rs
parent3cc3db073cc0661cfdd4116923ae4e312b64ec16 (diff)
downloadfparkan-3caf781850682fbf04958f70636471e546f0d426.tar.xz
fparkan-3caf781850682fbf04958f70636471e546f0d426.zip
fix(mission): recognize the exit from the teleporter floor
Behavior.dll at 0x18310 evaluates the cylinder with a candidate position queried through 0x14b30. Reuse the authored hero spawn clearance for the floor-level walking probe. Keep the cylinder from the licensed DLL oracle and the asset's original center. The stock Teleport input replay captures the portal, transfers to the lower passage and renders the victory at the glowing exit. Correct the focused fixture to use the actual factory and laboratory communicator floors.
Diffstat (limited to 'crates/fparkan-runtime/src/player_motion.rs')
-rw-r--r--crates/fparkan-runtime/src/player_motion.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/crates/fparkan-runtime/src/player_motion.rs b/crates/fparkan-runtime/src/player_motion.rs
index 5a999546..18bd2d68 100644
--- a/crates/fparkan-runtime/src/player_motion.rs
+++ b/crates/fparkan-runtime/src/player_motion.rs
@@ -32,6 +32,18 @@ const WATER_SURFACE: u32 = 0x0002_0000;
const WALK_COLLISION_DISTANCE: f32 = 0.16;
const WALK_SPEED_FALLBACK: f32 = 8.0;
+pub(super) fn spawn_floor_clearance(
+ terrain: &TerrainWorld,
+ [x, y, z]: [f32; 3],
+) -> Result<f32, EngineError> {
+ let floor = terrain
+ .height_at([x, y])
+ .map_err(|error| EngineError::Movement(error.to_string()))?;
+ Ok(floor.map_or(FLOOR_CLEARANCE, |floor| {
+ (z - floor).clamp(FLOOR_CLEARANCE, STEP_DOWN)
+ }))
+}
+
/// Player controls sampled once for a simulation step.
#[derive(Clone, Copy, Debug, Default)]
pub struct PlayerMotion {
@@ -433,14 +445,7 @@ fn plan_player_steps(
let mut max_floor_clearance = FLOOR_CLEARANCE;
if !flying && input.movement != [0.0; 2] {
if let Some(draft) = mission.object_drafts.get(cockpit.object_index) {
- let [x, y, z] = draft.position;
- if let Some(ground) = mission
- .terrain
- .height_at([x, y])
- .map_err(|err| EngineError::Movement(err.to_string()))?
- {
- max_floor_clearance = (z - ground).clamp(FLOOR_CLEARANCE, STEP_DOWN);
- }
+ max_floor_clearance = spawn_floor_clearance(&mission.terrain, draft.position)?;
}
}
let Some(resolve) = resolve else {