diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-01 08:27:02 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-01 08:27:02 +0300 |
| commit | 590c8f39b935f34fc6a4f9c033520c2c0359253d (patch) | |
| tree | a21ce927fa1593f8931c90bf38c33cc9bf60cccf /crates/fparkan-runtime/src/clan_combat_groups.rs | |
| parent | 8dcaf3d7e5be5ddb8bae3cd9ced3032875c861ae (diff) | |
| download | fparkan-590c8f39b935f34fc6a4f9c033520c2c0359253d.tar.xz fparkan-590c8f39b935f34fc6a4f9c033520c2c0359253d.zip | |
fix(ai): prepend base defence attacks to unit orders
The native task dispatcher inserts mode 2 at index zero without replacing the old list. Keep the interrupted order and queued tail, then run the base-defence wait after assigning the group in the stock mission.
Diffstat (limited to 'crates/fparkan-runtime/src/clan_combat_groups.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/clan_combat_groups.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/fparkan-runtime/src/clan_combat_groups.rs b/crates/fparkan-runtime/src/clan_combat_groups.rs index 71d8a2a5..50c86e16 100644 --- a/crates/fparkan-runtime/src/clan_combat_groups.rs +++ b/crates/fparkan-runtime/src/clan_combat_groups.rs @@ -147,11 +147,12 @@ impl CombatGroup { drafts: &[MissionObjectDraft], order: Handler15Invocation, ) -> Result<(), String> { - let (0, kind @ (3 | 4), 3) = (order.word_0, order.word_1, order.word_2) else { + let kind = order.word_1; + if order.word_0 != 0 || !matches!((kind, order.word_2), (3, 2 | 3) | (4, 3)) { return Err( - "Handler(28) requires a replacing patrol or attack order on group 0".into(), + "Handler(28) requires a supported patrol or attack order on group 0".into(), ); - }; + } let target = GroupTarget::resolve(world, mission, order.target) .ok_or("Handler(28) target is unavailable")?; for &unit in &self.members { @@ -186,7 +187,11 @@ impl CombatGroup { }; for &unit in &self.members { if let Some((handle, index)) = attack { - patrol.set_attack_target(world, unit, handle, index, point); + if order.word_2 == 2 { + patrol.prepend_attack(world, unit, handle, index); + } else { + patrol.set_attack_target(world, unit, handle, index, point); + } } else { let radius = match order.word_3 { 0 | u32::MAX => 60.0, |
