From 72ae7666d428c783a03b5378658890947f205de0 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 19:13:13 +0400 Subject: fix(ai): dispatch building loss to the former clan --- crates/fparkan-runtime/src/clan_targeting.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crates/fparkan-runtime/src/clan_targeting.rs') diff --git a/crates/fparkan-runtime/src/clan_targeting.rs b/crates/fparkan-runtime/src/clan_targeting.rs index ef580e43..4e710bca 100644 --- a/crates/fparkan-runtime/src/clan_targeting.rs +++ b/crates/fparkan-runtime/src/clan_targeting.rs @@ -365,6 +365,21 @@ fn strongest_threat(candidates: impl IntoIterator) -> Op strongest } +pub(super) fn inside_clan_area( + mission: &MissionDocument, + drafts: &[MissionObjectDraft], + world: &World, + clan: usize, + limit: f32, + building: ObjectHandle, +) -> bool { + clan_area(mission, drafts, world, clan, limit).is_some_and(|(anchor, radius)| { + transform_state(world, building).is_ok_and(|pose| { + distance_from_anchor(anchor, pose.position.map(f32::from_bits)) < radius + }) + }) +} + fn clan_area( mission: &MissionDocument, drafts: &[MissionObjectDraft], -- cgit v1.2.3