From be3b214702693eab36da4484624327d2cad8beec Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 06:17:23 +0400 Subject: fix(gameplay): ground the hero when a warbot is destroyed A passenger kept the destroyed chassis root height and carried that offset into walking. In Two Fortresses this left the hero above the entrance to the last bunker. Put the hero on the terrain at the last chassis position, and retain the current elevation when the chassis was on a building floor. The licensed chassis test reproduces the old height and verifies the ejection after projectile damage. The stock Two Fortresses replay confirms the height correction during combat. Workspace checks and a Vulkan validation run from the normal start passed. Native ejection placement and the flying vehicle case remain open. --- crates/fparkan-runtime/src/manual_chassis.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'crates/fparkan-runtime/src/manual_chassis.rs') diff --git a/crates/fparkan-runtime/src/manual_chassis.rs b/crates/fparkan-runtime/src/manual_chassis.rs index 49e0c7e7..3be28403 100644 --- a/crates/fparkan-runtime/src/manual_chassis.rs +++ b/crates/fparkan-runtime/src/manual_chassis.rs @@ -46,9 +46,10 @@ pub(super) fn support_step( mod tests { use super::*; use crate::{ - board_friendly_warbot, create, frame, frame_with_player_motion, load_gameplay_mission, - mission_object_handle, plan_player_motion, starting_cockpit, EngineServices, MissionMode, - MissionRequest, MissionStartupInput, PlayerMotion, + apply_projectile_hit, board_friendly_warbot, create, disembark_warbot, frame, + frame_with_player_motion, load_gameplay_mission, mission_object_handle, plan_player_motion, + starting_cockpit, EngineServices, MissionMode, MissionRequest, MissionStartupInput, + PlayerMotion, }; use fparkan_vfs::DirectoryVfs; use fparkan_world::{set_transform, transform_state, OriginalObjectId}; @@ -122,5 +123,17 @@ mod tests { .position, after.position ); + + assert_eq!( + apply_projectile_hit(&mut engine, robot, f32::MAX).unwrap(), + Some((0.0, true)) + ); + frame(&mut engine, 200).unwrap(); + assert!(mission_object_handle(&engine, id).is_none()); + assert_eq!(disembark_warbot(&mut engine).unwrap(), Some(hero)); + let exit = transform_state(&engine.world, hero.handle).unwrap(); + let terrain = &engine.loaded.as_ref().unwrap().terrain; + let floor = terrain.height_at([nx, ny]).unwrap().unwrap(); + assert_eq!(exit.position.map(f32::from_bits), [nx, ny, floor + 0.02]); } } -- cgit v1.2.3