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 --- apps/fparkan-game/src/main.rs | 3 +++ apps/fparkan-game/src/player_fire.rs | 24 +++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 5202bcf6..e5f6b9e8 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -11129,6 +11129,9 @@ impl StaticVulkanApp { if self.demo_camera.is_none() && code == KeyCode::KeyH { self.toggle_player_camouflage(); } + if self.demo_camera.is_none() && code == KeyCode::KeyA { + self.cycle_cockpit_control(); + } if let Some(slot) = [ KeyCode::Digit0, KeyCode::Digit1, diff --git a/apps/fparkan-game/src/player_fire.rs b/apps/fparkan-game/src/player_fire.rs index 5473f3a6..9f497f78 100644 --- a/apps/fparkan-game/src/player_fire.rs +++ b/apps/fparkan-game/src/player_fire.rs @@ -4,18 +4,36 @@ use super::{ }; use fparkan_runtime::{ - loaded_mission_assets, projectile_sight_target, remote_warbot_control, turret_sight_points, - FiringEffectInstance, PlayerWeaponWarning, RemoteWarbotControl, + cycle_warbot_control, loaded_mission_assets, projectile_sight_target, turret_sight_points, + warbot_control_mode, FiringEffectInstance, PlayerWeaponWarning, RemoteWarbotControl, }; impl StaticVulkanApp { pub(super) fn uses_automatic_weapons(&self) -> bool { self.mission_engine .as_ref() - .and_then(remote_warbot_control) + .and_then(warbot_control_mode) .is_some_and(|mode| mode != RemoteWarbotControl::Manual) } + pub(super) fn cycle_cockpit_control(&mut self) { + let Some((engine, cockpit)) = self.mission_engine.as_mut().zip(self.cockpit) else { + return; + }; + if warbot_control_mode(engine).is_none() { + return; + } + let manual = self + .player_weapon_layouts + .get(&cockpit.object_index) + .map(|layout| { + self.player_weapon_banks + .entry(cockpit.handle) + .or_insert_with(|| layout.weapons.clone()) + }); + cycle_warbot_control(engine, manual); + } + pub(super) fn sample_player_fire( &mut self, clock_ms: u32, -- cgit v1.2.3