From 96eb23d66b7e26a9a528fb47ce1056606933dc3e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 5 Aug 2024 18:43:27 -0700 Subject: [PATCH] test resimulation --- src/physics.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/physics.rs b/src/physics.rs index 07de30d..6a16617 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -1814,4 +1814,38 @@ mod test{ Time::ZERO ),None); } + fn simulate(map:&str,bot:&str){ + //create physics + let mut physics=PhysicsContext::default(); + + //load map + let map_file=std::fs::File::open(format!("/run/media/quat/Files/Documents/map-files/verify-scripts/maps/bhop_snfm/{map}.snfm")).unwrap(); + let map=strafesnet_snf::read_map(map_file).unwrap().into_complete_map().unwrap(); + physics.generate_models(&map); + + //load bot + let bot_file=std::fs::File::open(format!("/home/quat/strafesnet/strafe-client/tools/debug_bots/{bot}")).unwrap(); + let instructions=strafesnet_snf::bot::read_bot_debug(bot_file).unwrap(); + + //run bot on physics + for ins in instructions{ + physics.run_input_instruction(ins); + } + } + #[test] + fn simulate_bot_1(){ + simulate("5692113331","ff4940efb50f724e48eb54ce3593d88f") + } + #[test] + fn simulate_bot_2(){ + simulate("5692113331","17cf70412eba16d172a67385cab5727e") + } + #[test] + fn simulate_bot_3(){ + simulate("5692176057","f0fe0dc2fda5f8b59a658e82d26fc69") + } + #[test] + fn simulate_bot_4(){ + simulate("5692176057","c0631c6f524eebddbf75237cac48e78e") + } }