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. --- apps/fparkan-game/src/main.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'apps/fparkan-game/src') diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 7389e101..a8f3f431 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -107,7 +107,7 @@ use fparkan_render_vulkan::{ VulkanStaticTexture, VulkanStaticTextureMip, VulkanStaticVertex, }; use fparkan_runtime::{ - apply_projectile_contact, autodemo_camera, board_friendly_warbot, capture_building_with_notice, + apply_projectile_impact, autodemo_camera, board_friendly_warbot, capture_building_with_notice, capture_neutral_warbot, create, deploy_mine, disembark_warbot, frame as step_mission_frame, frame_with_player_motion, load_gameplay_mission_with_build_parts, load_mission_static_preview, load_mission_static_preview_roots, loaded_mission_assets, loaded_mission_object_drafts, @@ -117,7 +117,7 @@ use fparkan_runtime::{ starting_player_weapons, AutoDemoCamera, AutoDemoView, BuildingMeshNode, Engine, EngineError, EngineServices, FrameResult, LoadedMission, MissionAssets, MissionEventStop, MissionMode, MissionObjectDraft, MissionRequest, MissionStartupInput, PlayerMotion, PlayerProjectile, - PlayerWeapons, StartingCockpit, SIMULATION_COVERAGE, + PlayerWeapons, ProjectileImpact, StartingCockpit, SIMULATION_COVERAGE, }; #[cfg(test)] use fparkan_runtime::{load_mission_with_init_stubs, plan_player_motion}; @@ -10533,15 +10533,22 @@ impl StaticVulkanApp { }) { "communicator-field" } else if let Some(hit) = unit_contact { - match draw.volume.map(|volume| apply_projectile_contact(engine, hit, volume)).transpose() { - Ok(Some(Some((remaining, removed)))) => eprintln!( + let outcome = draw + .volume + .map(|volume| apply_projectile_impact(engine, hit, volume)) + .transpose(); + match &outcome { + Ok(Some(ProjectileImpact::ShieldAbsorbed)) => {}, + Ok(Some(ProjectileImpact::Damage { remaining, removed })) => eprintln!( "player_projectile_hit shooter={} pool={pool} target={} remaining={remaining} removed={removed} queue_time_ms={clock_ms}", shooter.slot, hit.handle.slot, ), outcome => eprintln!( "sim_coverage player_projectile_target_stub=1 target={} result={outcome:?}", hit.handle.slot, ), } - if hit.building_node().is_some() { + if matches!(outcome, Ok(Some(ProjectileImpact::ShieldAbsorbed))) { + "shield" + } else if hit.building_node().is_some() { "building" } else { "unit" -- cgit v1.2.3