From 099e48fa775b849654d1102a6c1d9e84ded7e1f4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 3 Dec 2026 19:00:18 +0400 Subject: feat(game): cycle warbot cockpit control modes --- crates/fparkan-runtime/src/cockpit_speedometer.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'crates/fparkan-runtime/src/cockpit_speedometer.rs') diff --git a/crates/fparkan-runtime/src/cockpit_speedometer.rs b/crates/fparkan-runtime/src/cockpit_speedometer.rs index 021fc3ec..5069013b 100644 --- a/crates/fparkan-runtime/src/cockpit_speedometer.rs +++ b/crates/fparkan-runtime/src/cockpit_speedometer.rs @@ -55,13 +55,19 @@ pub(super) fn record_route_speed( mission: &mut LoadedMissionState, patrol: Option<&PreparedPatrol>, ) { - mission.cockpit_speed = mission + let driving = mission .boarding - .filter(|board| board.remote == Some(RemoteWarbotControl::Autopilot)) - .zip(patrol) - .map_or(0.0, |(board, patrol)| { - patrol.speed_of(board.cockpit.handle, board.can_fly) - }); + .as_mut() + .filter(|board| board.control_mode == RemoteWarbotControl::Autopilot) + .zip(patrol); + mission.cockpit_speed = driving.map_or(0.0, |(board, patrol)| { + if board.can_fly { + if let Some(velocity) = patrol.flight_velocity_of(board.cockpit.handle) { + board.flight_velocity = velocity; + } + } + patrol.speed_of(board.cockpit.handle, board.can_fly) + }); } pub(super) fn length(vector: [f32; 3]) -> f32 { -- cgit v1.2.3