aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/unit_combat.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/fparkan-runtime/src/unit_combat.rs')
-rw-r--r--crates/fparkan-runtime/src/unit_combat.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/fparkan-runtime/src/unit_combat.rs b/crates/fparkan-runtime/src/unit_combat.rs
index 2d6a3715..1ebbac2a 100644
--- a/crates/fparkan-runtime/src/unit_combat.rs
+++ b/crates/fparkan-runtime/src/unit_combat.rs
@@ -95,6 +95,7 @@ pub(super) struct AutoDemoCombat {
projectiles: Vec<AutoDemoProjectileType>,
weapon_effects: Vec<(String, String)>,
flights: Vec<Flight>,
+ next_flight_id: u64,
finished_segments: Vec<(usize, [[f32; 3]; 2])>,
pose_failures: super::WeaponPoseReport,
pub(super) report: CombatReport,
@@ -130,6 +131,7 @@ impl Unit {
}
struct Flight {
+ id: u64,
shooter: ObjectHandle,
shooter_identity: CombatObject,
projectile: usize,
@@ -171,6 +173,7 @@ impl AutoDemoCombat {
projectiles: Vec::new(),
weapon_effects: Vec::new(),
flights: Vec::new(),
+ next_flight_id: 0,
finished_segments: Vec::new(),
pose_failures: super::WeaponPoseReport::default(),
report: CombatReport::default(),
@@ -320,10 +323,10 @@ impl AutoDemoCombat {
.aim(component)
}
- pub(super) fn flights(&self) -> impl Iterator<Item = (usize, PlayerProjectile)> + '_ {
+ pub(super) fn flights(&self) -> impl Iterator<Item = (u64, usize, PlayerProjectile)> + '_ {
self.flights
.iter()
- .map(|flight| (flight.projectile, flight.pose))
+ .map(|flight| (flight.id, flight.projectile, flight.pose))
}
pub(super) fn segments(&self) -> impl Iterator<Item = (usize, [[f32; 3]; 2])> + '_ {
@@ -701,12 +704,14 @@ impl AutoDemoCombat {
PlayerProjectile::new(from, direction, data.speed, data.lifetime_ms, now)
{
self.flights.push(Flight {
+ id: self.next_flight_id,
shooter: unit.handle,
shooter_identity: shooter,
projectile,
pose,
segment: None,
});
+ self.next_flight_id += 1;
self.report
.shot(shooter, CombatObject::read(&engine.world, target), now);
events.push(AutoDemoCombatEvent::Shot {