From c4baa5aea1abac26779ec5075232dba724ab6630 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 17:45:39 +0400 Subject: fix(combat): recognize hits absorbed by shields Use the same impact result for manual fire and autonomous weapons. A shield that spends its charge and absorbs a whole shot completes the impact without reporting an unavailable target. Keep the existing hull damage API for callers that only need remaining health. Checked in a window on the stock Two Fortresses map. The laser first ended at the shield and then reduced hull health after the sector was depleted. At 180 seconds of AutoDemo the false unavailable reports disappear and the destruction sequence is identical. --- crates/fparkan-runtime/src/projectile_shield.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/fparkan-runtime/src/projectile_shield.rs') diff --git a/crates/fparkan-runtime/src/projectile_shield.rs b/crates/fparkan-runtime/src/projectile_shield.rs index d41ea0bd..a0875278 100644 --- a/crates/fparkan-runtime/src/projectile_shield.rs +++ b/crates/fparkan-runtime/src/projectile_shield.rs @@ -279,8 +279,8 @@ mod tests { #[ignore = "requires licensed corpus"] fn licensed_autodemo_shield_blocks_and_then_exposes_one_sector() { use crate::{ - apply_projectile_contact, create, load_gameplay_mission, EngineServices, MissionMode, - MissionRequest, MissionStartupInput, + apply_projectile_impact, create, load_gameplay_mission, EngineServices, MissionMode, + MissionRequest, MissionStartupInput, ProjectileImpact, }; use fparkan_vfs::DirectoryVfs; use std::sync::Arc; @@ -337,10 +337,9 @@ mod tests { let (center, radius) = engine.shield_impacts.as_ref().unwrap().local_spheres[0] .expect("stock AutoDemo warbot enclosure"); assert!(center[2] > 0.0 && radius > 6.0); - assert!( - apply_projectile_contact(&mut engine, contact, capacity * 0.5) - .unwrap() - .is_none() + assert_eq!( + apply_projectile_impact(&mut engine, contact, capacity * 0.5).unwrap(), + ProjectileImpact::ShieldAbsorbed ); let impacts = take_shield_impacts(&mut engine); let [impact] = impacts.as_slice() else { -- cgit v1.2.3