aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 12:39:26 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 12:39:26 +0300
commit2bf70f8b1eca48ba40215a4e58aaf6b133d84b18 (patch)
tree61deae894a5e3c7aa78f65f3abc25a4a34091ac2
parent54b6e83f62fe52b221dcb7eebff245e9d5b39305 (diff)
downloadfparkan-2bf70f8b1eca48ba40215a4e58aaf6b133d84b18.tar.xz
fparkan-2bf70f8b1eca48ba40215a4e58aaf6b133d84b18.zip
fix(player): capture buildings at the communicator floor
On the stock Constructor map, walk through the factory basement to the communicator and press Enter. The first objective completes and the same path returns to ground level. The green ceiling no longer hides the floor in the contact query.
-rw-r--r--apps/fparkan-game/src/player_collision.rs4
-rw-r--r--crates/fparkan-runtime/src/lib.rs54
-rw-r--r--crates/fparkan-runtime/src/mission_events.rs14
-rw-r--r--docs/appendices/knowledge-boundaries.md2
-rw-r--r--docs/tomes/06-behavior.md15
5 files changed, 58 insertions, 31 deletions
diff --git a/apps/fparkan-game/src/player_collision.rs b/apps/fparkan-game/src/player_collision.rs
index c74a8ec8..c34422da 100644
--- a/apps/fparkan-game/src/player_collision.rs
+++ b/apps/fparkan-game/src/player_collision.rs
@@ -249,6 +249,10 @@ mod tests {
let z = f32::from_bits(hero.position[2]);
assert!(z < factory.position[2] - 4.0, "factory cabin at {z}");
assert_eq!(app.terrain.height_at([x, y]).unwrap(), None);
+ assert_eq!(
+ fparkan_runtime::capture_building(&mut engine, cockpit).unwrap(),
+ Some(fparkan_world::OriginalObjectId(0))
+ );
}
}
let [x, y, z] = hero.position.map(f32::from_bits);
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs
index 9a2b8a56..a67276a3 100644
--- a/crates/fparkan-runtime/src/lib.rs
+++ b/crates/fparkan-runtime/src/lib.rs
@@ -18214,7 +18214,7 @@ mod tests {
);
assert_eq!(capture_building(&mut engine, hero).unwrap(), None);
let mut pose = transform_state(&engine.world, hero.handle).unwrap();
- pose.position = [1871.4402_f32, 2020.2354, 61.34749].map(f32::to_bits);
+ pose.position = [1871.4402_f32, 2020.2354, 56.974].map(f32::to_bits);
set_transform(&mut engine.world, hero.handle, pose).unwrap();
assert_eq!(capture_neutral_building(&mut engine, hero).unwrap(), None);
let count = |engine: &Engine| {
@@ -18567,8 +18567,8 @@ mod tests {
);
let mut player_pose = transform_state(&engine.world, cockpit.handle).unwrap();
for (time, logic_id, objective_index, plate) in [
- (2001, 0x8000_0001, 0, [391.3_f32, 740.1, 145.12]),
- (4001, 0x8000_0003, 2, [1268.1, 790.6, 160.77]),
+ (2001, 0x8000_0001, 0, [391.3_f32, 740.1, 140.74]),
+ (4001, 0x8000_0003, 2, [1268.1, 790.6, 153.55]),
] {
let slot = engine
.loaded
@@ -18584,7 +18584,7 @@ mod tests {
identity_metadata(&engine.world, handle).unwrap().owner_id,
Some(OwnerId(2))
);
- for z in [plate[2] + 12.0, plate[2] - 6.0] {
+ for z in [plate[2] + 5.0, plate[2] - 6.0] {
player_pose.position = [plate[0], plate[1], z].map(f32::to_bits);
set_transform(&mut engine.world, cockpit.handle, player_pose).unwrap();
assert_eq!(
@@ -18633,7 +18633,7 @@ mod tests {
loaded_mission_script_outcome(&engine),
Some(MissionScriptOutcome::Active)
);
- player_pose.position = [391.3_f32, 740.1, 145.12].map(f32::to_bits);
+ player_pose.position = [391.3_f32, 740.1, 140.74].map(f32::to_bits);
set_transform(&mut engine.world, cockpit.handle, player_pose).unwrap();
assert_eq!(
order_factory_robot(&mut engine, cockpit, 4001).unwrap(),
@@ -18642,7 +18642,19 @@ mod tests {
assert!(order_factory_robot(&mut engine, cockpit, 4002).is_err());
let early = frame(&mut engine, 64_000).unwrap();
assert!(early.produced_unit.is_none());
- let complete = frame(&mut engine, 64_001).unwrap();
+ let wait_for_release = |engine: &mut Engine, now: &mut u32| {
+ let deadline = *now + 20_000;
+ while *now < deadline {
+ *now += 17;
+ let result = frame(engine, *now).unwrap();
+ if result.produced_unit.is_some() {
+ return result;
+ }
+ }
+ panic!("factory did not release its order by {deadline} ms");
+ };
+ let mut now = 64_000;
+ let complete = wait_for_release(&mut engine, &mut now);
let robot = complete.produced_unit.expect("finished robot");
assert!(complete.snapshot.objects.contains(&robot.handle));
assert_eq!(
@@ -18651,7 +18663,8 @@ mod tests {
.owner_id,
Some(OwnerId(0))
);
- let next = frame(&mut engine, 66_001).unwrap();
+ now += 2_000;
+ let next = frame(&mut engine, now).unwrap();
assert!(next.produced_unit.is_none());
let event = next.mission_event.unwrap();
assert!(event.stop.is_none(), "{:?}", event.stop);
@@ -18660,6 +18673,18 @@ mod tests {
loaded_mission_script_outcome(&engine),
Some(MissionScriptOutcome::Completed)
);
+ let factory = mission_object_handle(&engine, OriginalObjectId(0)).unwrap();
+ let departure_deadline = now + 20_000;
+ while engine
+ .loaded
+ .as_ref()
+ .and_then(|mission| mission.unit_patrol.as_ref())
+ .is_some_and(|patrol| patrol.has_factory_departure(factory))
+ {
+ assert!(now < departure_deadline, "robot did not leave the factory");
+ now += 17;
+ frame(&mut engine, now).unwrap();
+ }
assert_eq!(
board_friendly_warbot(&mut engine, Some(robot.handle)).unwrap(),
None
@@ -18702,7 +18727,8 @@ mod tests {
)
.unwrap()
.unwrap();
- frame_with_player_motion(&mut engine, 66_101, vehicle, motion, false).unwrap();
+ now += 100;
+ frame_with_player_motion(&mut engine, now, vehicle, motion, false).unwrap();
let driven = transform_state(&engine.world, vehicle.handle).unwrap();
assert_ne!(driven.position, robot_pose.position);
assert_eq!(
@@ -18719,14 +18745,14 @@ mod tests {
.position,
driven.position
);
- player_pose.position = [391.3_f32, 740.1, 145.12].map(f32::to_bits);
+ player_pose.position = [391.3_f32, 740.1, 140.74].map(f32::to_bits);
set_transform(&mut engine.world, cockpit.handle, player_pose).unwrap();
let mut live = vec![robot];
- let mut now = 68_001;
for _ in 1..production::RESERVE_SLOTS {
let duration = order_factory_robot(&mut engine, cockpit, now).unwrap();
- now += duration;
- let result = frame(&mut engine, now).unwrap();
+ now += duration - 1;
+ frame(&mut engine, now).unwrap();
+ let result = wait_for_release(&mut engine, &mut now);
let new = result.produced_unit.expect("another finished robot");
assert!(live.iter().all(|unit| unit.object_index != new.object_index
&& result.snapshot.objects.contains(&unit.handle)));
@@ -18735,7 +18761,9 @@ mod tests {
assert!(order_factory_robot(&mut engine, cockpit, now).is_err());
fparkan_world::request_delete(&mut engine.world, robot.handle).unwrap();
let duration = order_factory_robot(&mut engine, cockpit, now).unwrap();
- let replaced = frame(&mut engine, now + duration).unwrap();
+ now += duration - 1;
+ frame(&mut engine, now).unwrap();
+ let replaced = wait_for_release(&mut engine, &mut now);
let replacement = replaced.produced_unit.expect("reused slot");
assert_eq!(replacement.object_index, robot.object_index);
assert_ne!(replacement.handle, robot.handle);
diff --git a/crates/fparkan-runtime/src/mission_events.rs b/crates/fparkan-runtime/src/mission_events.rs
index a198bfdd..ec976224 100644
--- a/crates/fparkan-runtime/src/mission_events.rs
+++ b/crates/fparkan-runtime/src/mission_events.rs
@@ -624,7 +624,6 @@ pub(super) fn communicator_triangles(
pose: super::TransformState,
) -> Option<Vec<[[f32; 3]; 3]>> {
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 {
@@ -679,15 +678,10 @@ pub(super) fn communicator_triangles(
transform.try_transform_scaled_point(pose.transform_point(local), scale)
});
let (a, b, c) = (a?, b?, c?);
- 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;
- }
- }
- Some([a, b, c])
+ // The floor and ceiling of the communicator share the same material.
+ let normal_z =
+ (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
+ (normal_z > 0.0).then_some([a, b, c])
})
})
.collect(),
diff --git a/docs/appendices/knowledge-boundaries.md b/docs/appendices/knowledge-boundaries.md
index e3dc0d0f..81f77ad3 100644
--- a/docs/appendices/knowledge-boundaries.md
+++ b/docs/appendices/knowledge-boundaries.md
@@ -142,7 +142,7 @@ authoring API без динамического подтверждения.
Время доводки, поправки направления орудий и отдельный обзор со Shift открыты.
Вход и выход у BAS используют вырезанный рельеф и опоры геометрии здания.
Через стыки без результата пробы сохраняется высота. Выбор героя по владельцу,
-пределы ступеней и физика падения ещё открыты.
+предел подъёма по склону, пределы ступеней и физика падения ещё открыты.
Контакт героя с водой завершает миссию на первом мокром шаге.
Анимация, звук гибели и реакция шасси при погружении остаются открытыми.
diff --git a/docs/tomes/06-behavior.md b/docs/tomes/06-behavior.md
index 5d83e561..d0981e22 100644
--- a/docs/tomes/06-behavior.md
+++ b/docs/tomes/06-behavior.md
@@ -2964,9 +2964,12 @@ FParkan показывает эти строки поверх сцены по п
В «Конструкторе» главный машинный зал отмечен указателями. Подсказка
`T02_H01` направляет игрока на зелёную площадку, с которой доступен
-компьютер завода. FParkan находит площадку по треугольникам материала
-`B_COMP_4G` в модели здания. После нажатия Enter на площадке нейтральное
-строение переходит к клану игрока. Сценарий считывает нового владельца
+компьютер завода. FParkan находит площадку по обращённым вверх
+треугольникам материала `B_COMP_4G` в модели здания. Пол и потолок рубки
+используют этот материал. Проверка по полу позволяет захватить завод
+после спуска по лестнице со штатной позиции героя. После нажатия Enter
+на площадке нейтральное строение переходит к клану игрока.
+Сценарий считывает нового владельца
при следующей проверке целей. Захваченный завод также переходит в
распределитель нового клана, откуда получает руду и энергию по запросу.
При переносе распределители пересчитывают доли участников.
@@ -2976,10 +2979,8 @@ FParkan показывает эти строки поверх сцены по п
и обычный допуск по высоте. После захвата генератор подаёт энергию игроку,
а сценарий засчитывает первую цель и включает следующую реплику.
-В «Телепорте» зелёная площадка принадлежит материалу `B_COMP_4G`. Тот
-же материал есть на потолке над площадкой. Для захвата телепорта FParkan
-берёт обращённые вверх треугольники пола, поэтому Enter срабатывает внизу
-и сценарий засчитывает смену владельца.
+Тот же материал обозначает пол рубки ангара и зелёную площадку
+в «Телепорте».
При ходьбе движок опускает короткий отрезок от предполагаемого положения
героя до ближайшей поверхности здания. Так высота следует за полом