aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-03 18:00:18 +0300
committerValentin Popov <valentin@popov.link>2026-12-03 18:00:18 +0300
commit099e48fa775b849654d1102a6c1d9e84ded7e1f4 (patch)
tree25864aa84bdb465d0ca52f5d28c5a1b20a23e041 /apps/fparkan-game
parent4b9277258224ab846b84cafe1d6a3b91e29a05c5 (diff)
downloadfparkan-099e48fa775b849654d1102a6c1d9e84ded7e1f4.tar.xz
fparkan-099e48fa775b849654d1102a6c1d9e84ded7e1f4.zip
feat(game): cycle warbot cockpit control modes
Diffstat (limited to 'apps/fparkan-game')
-rw-r--r--apps/fparkan-game/src/main.rs3
-rw-r--r--apps/fparkan-game/src/player_fire.rs24
2 files changed, 24 insertions, 3 deletions
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,