aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/player_weapon.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 08:43:49 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 08:43:49 +0300
commit176b377c8d4406161ff206a8cb5ac8c8359877cf (patch)
tree99394195838de49cd8c820d7efc6fa7936217131 /crates/fparkan-runtime/src/player_weapon.rs
parentacc5af7cc79a5ee2132c5d10528ca1cf06186832 (diff)
downloadfparkan-176b377c8d4406161ff206a8cb5ac8c8359877cf.tar.xz
fparkan-176b377c8d4406161ff206a8cb5ac8c8359877cf.zip
feat(runtime): engage hostile robots in AutoDemo
Diffstat (limited to 'crates/fparkan-runtime/src/player_weapon.rs')
-rw-r--r--crates/fparkan-runtime/src/player_weapon.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/player_weapon.rs b/crates/fparkan-runtime/src/player_weapon.rs
index 79b9186a..5e5e4152 100644
--- a/crates/fparkan-runtime/src/player_weapon.rs
+++ b/crates/fparkan-runtime/src/player_weapon.rs
@@ -270,6 +270,17 @@ fn prepare_weapons(control: &PreparedComponentControl) -> Vec<PlayerWeapon> {
.collect()
}
+pub(super) fn prepare_unit_weapons(controls: &[Option<PreparedComponentControl>]) -> PlayerWeapons {
+ PlayerWeapons {
+ weapons: controls
+ .iter()
+ .flatten()
+ .flat_map(prepare_weapons)
+ .collect(),
+ ..PlayerWeapons::default()
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;