diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-01 18:13:13 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-01 18:13:13 +0300 |
| commit | 72ae7666d428c783a03b5378658890947f205de0 (patch) | |
| tree | 7ab19d6b3104c906a84d5cf9839b103735d27e47 /crates/fparkan-runtime/src/clan_targeting.rs | |
| parent | f7c5c3bffd565bb6b0995a220ecb7788471b7848 (diff) | |
| download | fparkan-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.rs | 15 |
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], |
