aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/unit_combat.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 11:16:16 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 11:16:16 +0300
commitdfbdef7d4d1d295ee962dd8aab754ce6be902f8d (patch)
tree9c9f2b6fd6f9519ee05868df3f0d950e00318c24 /crates/fparkan-runtime/src/unit_combat.rs
parenta519d5efefb4d846a9f65c6b9376fa245215a0f6 (diff)
downloadfparkan-dfbdef7d4d1d295ee962dd8aab754ce6be902f8d.tar.xz
fparkan-dfbdef7d4d1d295ee962dd8aab754ce6be902f8d.zip
fix(ai): follow capture passages through building doors
A stock Two Fortresses run now takes the generator after the capturer descends its authored hallway. Symmetric Res17 door links drive the CTLD animation and unsupported routes retain explicit coverage. Checked the approach and descent in the game window with Vulkan validation and verified the owner transfer in a licensed test.
Diffstat (limited to 'crates/fparkan-runtime/src/unit_combat.rs')
-rw-r--r--crates/fparkan-runtime/src/unit_combat.rs21
1 files changed, 17 insertions, 4 deletions
diff --git a/crates/fparkan-runtime/src/unit_combat.rs b/crates/fparkan-runtime/src/unit_combat.rs
index eaadc159..c7d807cc 100644
--- a/crates/fparkan-runtime/src/unit_combat.rs
+++ b/crates/fparkan-runtime/src/unit_combat.rs
@@ -1106,10 +1106,15 @@ mod tests {
#[test]
#[ignore = "requires licensed corpus"]
- fn licensed_stock_capturer_and_defender_exchange_fire() {
+ fn licensed_stock_capturer_presses_through_defender_fire_and_takes_generator() {
let mut engine = stock_two_fortresses();
let defender = mission_object_handle(&engine, OriginalObjectId(17)).unwrap();
let capturer = mission_object_handle(&engine, OriginalObjectId(11)).unwrap();
+ let generator = mission_object_handle(&engine, OriginalObjectId(1)).unwrap();
+ let original_owner = identity_metadata(&engine.world, generator)
+ .unwrap()
+ .owner_id;
+ assert_ne!(original_owner, Some(OwnerId(1)));
let before = transform_state(&engine.world, defender).unwrap();
assert_eq!(mission_guard_fallback_count(&engine), 0);
assert!(frame(&mut engine, 0)
@@ -1119,7 +1124,7 @@ mod tests {
let mut capturer_fired_while_moving = false;
let mut defender_fired = false;
- for tick in 1..=60 * 190 {
+ for tick in 1..=60 * 210 {
let before_capturer = transform_state(&engine.world, capturer).ok();
let result = frame(&mut engine, tick * 1000 / 60).unwrap();
for event in result.autodemo_combat_events {
@@ -1150,11 +1155,19 @@ mod tests {
}
}
}
- if capturer_fired_while_moving && defender_fired {
+ if identity_metadata(&engine.world, generator)
+ .unwrap()
+ .owner_id
+ == Some(OwnerId(1))
+ {
+ assert!(capturer_fired_while_moving && defender_fired);
+ let position = transform_state(&engine.world, capturer).unwrap().position;
+ let roof = transform_state(&engine.world, generator).unwrap().position;
+ assert!(f32::from_bits(position[2]) < f32::from_bits(roof[2]));
return;
}
}
- panic!("expected both sides to fire (moving={capturer_fired_while_moving}, defender={defender_fired})");
+ panic!("the first capturer did not take the generator (moving={capturer_fired_while_moving}, defender={defender_fired})");
}
#[test]