diff options
Diffstat (limited to 'crates/fparkan-runtime/src/attack_target.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/attack_target.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/attack_target.rs b/crates/fparkan-runtime/src/attack_target.rs new file mode 100644 index 00000000..ddf9cb3e --- /dev/null +++ b/crates/fparkan-runtime/src/attack_target.rs @@ -0,0 +1,24 @@ +use crate::MissionControlDeviceTableState; +use fparkan_world::{registration_sequence, transform_state, ObjectHandle, World}; + +/// Behavior+0x27250 ends Attack on a missing/depleted object or a zero position. +pub(super) fn complete( + world: &World, + controls: &[MissionControlDeviceTableState], + target: ObjectHandle, +) -> bool { + if !registration_sequence(world, target).is_ok_and(|sequence| sequence.is_some()) { + return true; + } + if controls + .iter() + .any(|table| table.handle == target && table.node_provider_depletion_marked) + { + return true; + } + transform_state(world, target).map_or(true, |pose| { + pose.position + .into_iter() + .all(|word| f32::from_bits(word) == 0.0) + }) +} |
