aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/strategic_view.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 13:38:56 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 13:38:56 +0300
commit05da53f0344416a5f14211a73f1f48d72c88b954 (patch)
treed27d22f56a1bd185447b27223c79c9f97f7cc165 /apps/fparkan-game/src/strategic_view.rs
parent787279a1f514fbbaf09ca9dd6e5015bdce36635b (diff)
downloadfparkan-05da53f0344416a5f14211a73f1f48d72c88b954.tar.xz
fparkan-05da53f0344416a5f14211a73f1f48d72c88b954.zip
feat(ui): drive a strategic warbot with an automatic gunner
Diffstat (limited to 'apps/fparkan-game/src/strategic_view.rs')
-rw-r--r--apps/fparkan-game/src/strategic_view.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/apps/fparkan-game/src/strategic_view.rs b/apps/fparkan-game/src/strategic_view.rs
index 6e94d28a..8dc0e57c 100644
--- a/apps/fparkan-game/src/strategic_view.rs
+++ b/apps/fparkan-game/src/strategic_view.rs
@@ -12,6 +12,7 @@ use fparkan_runtime::strategic_view::{
use fparkan_runtime::{
projectile_unit_hit, satellite_contacts,
strategic_orders::{self, PatrolTarget},
+ RemoteWarbotControl,
};
use fparkan_terrain::{FullSurfaceMask, SurfaceHit, SurfaceQuery};
use fparkan_world::ObjectHandle;
@@ -388,9 +389,14 @@ impl StaticVulkanApp {
view.warbots_open = false;
return;
}
- Some(ListHit::ManualControl) => {
+ Some(mode @ (ListHit::ManualControl | ListHit::AutoGunner)) => {
if let Some(row) = selected {
- self.take_manual_warbot_control(row.handle);
+ let mode = if mode == ListHit::ManualControl {
+ RemoteWarbotControl::Manual
+ } else {
+ RemoteWarbotControl::AutoGunner
+ };
+ self.take_warbot_control(row.handle, mode);
}
return;
}
@@ -451,24 +457,32 @@ impl StaticVulkanApp {
}
}
- fn take_manual_warbot_control(&mut self, target: ObjectHandle) {
+ fn take_warbot_control(&mut self, target: ObjectHandle, mode: RemoteWarbotControl) {
let Some((engine, hero)) = self.mission_engine.as_mut().zip(self.cockpit) else {
return;
};
- let Some(vehicle) = fparkan_runtime::control_warbot_remotely(engine, hero, target) else {
+ let Some(vehicle) = fparkan_runtime::control_warbot_remotely(engine, hero, target, mode)
+ else {
return;
};
self.remote_command_view = self.command_view.take();
if let Some(view) = &mut self.remote_command_view {
view.order_input = None;
view.pointer = None;
+ if mode == RemoteWarbotControl::AutoGunner {
+ view.warbots_open = false;
+ }
}
self.cockpit = Some(vehicle);
self.boarded_hero_index = Some(hero.object_index);
self.boarding_target = None;
self.player_mouse = [0.0; 2];
self.player_move_pressed = Default::default();
- if let Some(layout) = self.player_weapon_layouts.get(&vehicle.object_index) {
+ if let Some(layout) = self
+ .player_weapon_layouts
+ .get(&vehicle.object_index)
+ .filter(|_| mode == RemoteWarbotControl::Manual)
+ {
self.player_weapon_banks
.entry(vehicle.handle)
.or_insert_with(|| layout.weapons.clone());