aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 14:29:01 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 14:29:01 +0300
commit94a65ec3f69ff92538b9b345033405fb51c5c8eb (patch)
tree2f75f2f8ff14f906bc70ddc59126eccdd573e544 /crates/fparkan-runtime/src
parent9dc88e53f0f289056d8dc45dda3b24cc89d7ed34 (diff)
downloadfparkan-94a65ec3f69ff92538b9b345033405fb51c5c8eb.tar.xz
fparkan-94a65ec3f69ff92538b9b345033405fb51c5c8eb.zip
test(factory): use communicator floors in the paid order fixture
The Field Camp fixture used the previous height of the factory communicator. Take its standing point and the bunker standing point from their loaded floors. This restores the licensed test for completing four paid orders and releasing the scripted patrol.
Diffstat (limited to 'crates/fparkan-runtime/src')
-rw-r--r--crates/fparkan-runtime/src/production.rs24
1 files changed, 15 insertions, 9 deletions
diff --git a/crates/fparkan-runtime/src/production.rs b/crates/fparkan-runtime/src/production.rs
index 820bb40f..824cf09a 100644
--- a/crates/fparkan-runtime/src/production.rs
+++ b/crates/fparkan-runtime/src/production.rs
@@ -1205,15 +1205,21 @@ mod tests {
let cockpit = starting_cockpit(&engine).unwrap();
let mut pose = transform_state(&engine.world, cockpit.handle).unwrap();
let plant = handle_by_original_id(&engine.world, OriginalObjectId(7)).unwrap();
- let plant_pose = transform_state(&engine.world, plant).unwrap();
- let transform = fparkan_render::LegacyIron3dEulerTransform {
- translation: plant_pose.position.map(f32::from_bits),
- orientation_radians: plant_pose.orientation.map(f32::from_bits),
+ let communicator_floor = |engine: &Engine, index: u32| {
+ let mission = engine.loaded.as_ref().unwrap();
+ let draft = &mission.object_drafts[index as usize];
+ let handle = handle_by_original_id(&engine.world, OriginalObjectId(index)).unwrap();
+ let pose = transform_state(&engine.world, handle).unwrap();
+ let [a, b, c] = crate::mission_events::communicator_triangles(
+ &mission.mission_assets,
+ index as usize,
+ draft.unit_dat_header_flags.unwrap(),
+ pose,
+ )
+ .unwrap()[0];
+ std::array::from_fn(|axis| ((a[axis] + b[axis] + c[axis]) / 3.0).to_bits())
};
- pose.position = transform
- .try_transform_scaled_point([0.08, -48.64, -6.63], plant_pose.scale.map(f32::from_bits))
- .unwrap()
- .map(f32::to_bits);
+ pose.position = communicator_floor(&engine, 7);
set_transform(&mut engine.world, cockpit.handle, pose).unwrap();
assert_eq!(
order_factory_robot(&mut engine, cockpit, 100).unwrap(),
@@ -1256,7 +1262,7 @@ mod tests {
"unpowered production device must lose its full work rate"
);
let factory_position = pose.position;
- pose.position = [1288.99_f32, 807.4, 74.08].map(f32::to_bits);
+ pose.position = communicator_floor(&engine, 0);
set_transform(&mut engine.world, cockpit.handle, pose).unwrap();
assert_eq!(
capture_neutral_building(&mut engine, cockpit).unwrap(),