aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/clan_targeting.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-01 18:13:13 +0300
committerValentin Popov <valentin@popov.link>2026-12-01 18:13:13 +0300
commit72ae7666d428c783a03b5378658890947f205de0 (patch)
tree7ab19d6b3104c906a84d5cf9839b103735d27e47 /crates/fparkan-runtime/src/clan_targeting.rs
parentf7c5c3bffd565bb6b0995a220ecb7788471b7848 (diff)
downloadfparkan-72ae7666d428c783a03b5378658890947f205de0.tar.xz
fparkan-72ae7666d428c783a03b5378658890947f205de0.zip
fix(ai): dispatch building loss to the former clan
Diffstat (limited to 'crates/fparkan-runtime/src/clan_targeting.rs')
-rw-r--r--crates/fparkan-runtime/src/clan_targeting.rs15
1 files changed, 15 insertions, 0 deletions
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<Item = (u32, u32, f32)>) -> 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],