aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/lib.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 05:40:09 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 05:40:09 +0300
commit5a2aa6ff6b6f4ab2480eed5be90957377d00c9e2 (patch)
tree158d1f3450a092797b4b87745eef56db1622c2bd /crates/fparkan-runtime/src/lib.rs
parent3837bebc873a32914139e8987a34716008da716c (diff)
downloadfparkan-5a2aa6ff6b6f4ab2480eed5be90957377d00c9e2.tar.xz
fparkan-5a2aa6ff6b6f4ab2480eed5be90957377d00c9e2.zip
feat(combat): play spatial sounds for autonomous weapon shots
Carry the firing effect and muzzle position on the shot event. Resolve single-gun effects by their matching muzzle point when there is no node link. Play each one-shot as its simulation frame arrives. Verified a stock gun sound enqueues a spatial voice with the flight starting position. AutoDemo ran with Vulkan validation clean and no playback errors. Comparison by ear with the original remains open.
Diffstat (limited to 'crates/fparkan-runtime/src/lib.rs')
-rw-r--r--crates/fparkan-runtime/src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs
index 53a41112..71afd080 100644
--- a/crates/fparkan-runtime/src/lib.rs
+++ b/crates/fparkan-runtime/src/lib.rs
@@ -3354,6 +3354,14 @@ pub fn autodemo_projectile_types(engine: &Engine) -> &[AutoDemoProjectileType] {
.map_or(&[], unit_combat::AutoDemoCombat::types)
}
+/// Asset sources referenced by autonomous weapon firing events.
+pub fn autonomous_weapon_effects(engine: &Engine) -> &[(String, String)] {
+ engine
+ .autodemo_combat
+ .as_ref()
+ .map_or(&[], unit_combat::AutoDemoCombat::weapon_effects)
+}
+
/// Active autonomous flights in the current world.
pub fn autodemo_projectiles(
engine: &Engine,
@@ -16576,6 +16584,7 @@ mod tests {
shooter,
target,
projectile,
+ ..
} => {
assert_ne!(shooter, target);
assert!(projectile < autodemo_projectile_types(&engine).len());