diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 13:59:29 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 13:59:29 +0300 |
| commit | 98569dc5e8ee01b19ee82852a807f6a2b911dae4 (patch) | |
| tree | 71dce6e11eaef918fc817b9393c0e190f661dd1c /crates/fparkan-runtime/src/player_motion.rs | |
| parent | 05da53f0344416a5f14211a73f1f48d72c88b954 (diff) | |
| download | fparkan-98569dc5e8ee01b19ee82852a807f6a2b911dae4.tar.xz fparkan-98569dc5e8ee01b19ee82852a807f6a2b911dae4.zip | |
feat(ui): watch a warbot on autopilot from its cockpit
Diffstat (limited to 'crates/fparkan-runtime/src/player_motion.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/player_motion.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/fparkan-runtime/src/player_motion.rs b/crates/fparkan-runtime/src/player_motion.rs index 73129d87..be910936 100644 --- a/crates/fparkan-runtime/src/player_motion.rs +++ b/crates/fparkan-runtime/src/player_motion.rs @@ -429,7 +429,16 @@ fn plan_player_steps( let boarded = mission .boarding .filter(|boarding| boarding.cockpit.handle == cockpit.handle); - let flight = boarded.filter(|boarding| boarding.can_fly).map(|boarding| { + let driving = boarded.filter(|boarding| boarding.controls_chassis()); + if boarded.is_some() && driving.is_none() { + input.movement = [0.0; 2]; + input.climb = 0.0; + if !input.look_around { + input.mouse_x = 0.0; + input.mouse_y = 0.0; + } + } + let flight = driving.filter(|boarding| boarding.can_fly).map(|boarding| { let profile = mission .control_device_tables .iter() @@ -443,7 +452,7 @@ fn plan_player_steps( } }); let flying = flight.is_some(); - let chassis_ground = boarded.and_then(|boarding| boarding.ground); + let chassis_ground = driving.and_then(|boarding| boarding.ground); let hero_profile = if mission.local_hero == Some(cockpit.handle) { mission .control_device_tables |
