diff options
| -rw-r--r-- | crates/fparkan-runtime/src/lib.rs | 28 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/mission_events.rs | 6 | ||||
| -rw-r--r-- | docs/tomes/06-behavior.md | 5 |
3 files changed, 37 insertions, 2 deletions
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 483ffb71..f0be9bad 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -18039,6 +18039,34 @@ mod tests { after.notices.contains(&MissionNotice::ObjectiveComplete(0)), "{after:?}" ); + for (time, slot, objective, plate) in [ + (4_001, 4, 1, [750.0_f32, 950.7, 45.88]), + (6_001, 5, 2, [950.7, 869.4, 69.98]), + (8_001, 3, 4, [1179.28, 1242.12, 101.60]), + ] { + if slot == 3 { + pose.position = [plate[0], plate[1], 110.28].map(f32::to_bits); + set_transform(&mut engine.world, cockpit.handle, pose).unwrap(); + assert_eq!( + capture_neutral_building(&mut engine, cockpit).unwrap(), + None + ); + } + pose.position = plate.map(f32::to_bits); + set_transform(&mut engine.world, cockpit.handle, pose).unwrap(); + assert_eq!( + capture_neutral_building(&mut engine, cockpit).unwrap(), + Some(OriginalObjectId(slot)), + ); + let event = frame(&mut engine, time).unwrap().mission_event.unwrap(); + assert!(event.stop.is_none(), "{event:?}"); + assert!( + event + .notices + .contains(&MissionNotice::ObjectiveComplete(objective)), + "{event:?}" + ); + } } #[test] diff --git a/crates/fparkan-runtime/src/mission_events.rs b/crates/fparkan-runtime/src/mission_events.rs index 8e420e4f..61624135 100644 --- a/crates/fparkan-runtime/src/mission_events.rs +++ b/crates/fparkan-runtime/src/mission_events.rs @@ -17,6 +17,7 @@ use fparkan_world::{ use std::collections::HashSet; const MOBILE_HQ_CLASS: u32 = 0x0101_0000; +const MAIN_TELEPORT_CLASS: u32 = 0x8000_0200; /// First encounter with an uncovered periodic script instruction. #[derive(Clone, Debug, Eq, PartialEq)] @@ -368,6 +369,7 @@ pub(super) fn on_communicator( [x, y, z]: [f32; 3], ) -> bool { let is_generator = class == 0x8000_0002; + let floor_only = is_generator || class == MAIN_TELEPORT_CLASS; let material = if is_generator { &b"B_MTP_07G"[..] } else { @@ -432,8 +434,8 @@ pub(super) fn on_communicator( transform.try_transform_scaled_point(pose.transform_point(local), scale) }); let (a, b, c) = (a?, b?, c?); - if is_generator { - // The generator also uses this material on the underside. + if floor_only { + // These models use the platform material on both the floor and the surface above it. let winding = (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); if winding <= 0.0 { return None; diff --git a/docs/tomes/06-behavior.md b/docs/tomes/06-behavior.md index 4ee604ec..a971ec91 100644 --- a/docs/tomes/06-behavior.md +++ b/docs/tomes/06-behavior.md @@ -2021,6 +2021,11 @@ FParkan выбирает ближайший дружественный варбÐ и обычный допуск по высоте. После захвата генератор подаёт энергию игроку, а сценарий засчитывает первую цель и включает следующую реплику. +В «Телепорте» зелёная площадка принадлежит материалу `B_COMP_4G`. Тот +же материал есть на потолке над площадкой. Для захвата телепорта FParkan +берёт обращённые вверх треугольники пола, поэтому Enter срабатывает внизу +и сценарий засчитывает смену владельца. + При ходьбе движок опускает короткий отрезок от предполагаемого положения героя до ближайшей поверхности здания. Так высота следует за полом или лестницей в пределах одного шага. В «Конструкторе» пол машинного зала |
