From 195014400f0a095930c833b57c8f90d32e9470ea Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Tue, 21 Jan 2025 07:47:39 -0800
Subject: [PATCH] apply setvelocity before teleport and jump

---
 strafe-client/src/physics.rs | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/strafe-client/src/physics.rs b/strafe-client/src/physics.rs
index 155c2abc..8a49355a 100644
--- a/strafe-client/src/physics.rs
+++ b/strafe-client/src/physics.rs
@@ -1560,6 +1560,21 @@ fn collision_start_contact(
 			}
 		},
 	}
+	match &attr.general.trajectory{
+		Some(trajectory)=>{
+			match trajectory{
+				gameplay_attributes::SetTrajectory::AirTime(_)=>todo!(),
+				gameplay_attributes::SetTrajectory::Height(_)=>todo!(),
+				gameplay_attributes::SetTrajectory::TargetPointTime{..}=>todo!(),
+				gameplay_attributes::SetTrajectory::TargetPointSpeed{..}=>todo!(),
+				&gameplay_attributes::SetTrajectory::Velocity(velocity)=>{
+					move_state.cull_velocity(velocity,body,touching,models,hitbox_mesh,style,camera,input_state);
+				},
+				gameplay_attributes::SetTrajectory::DotVelocity{..}=>todo!(),
+			}
+		},
+		None=>(),
+	}
 	//I love making functions with 10 arguments to dodge the borrow checker
 	if allow_run_teleport_behaviour{
 		run_teleport_behaviour(model_id,attr.general.wormhole.as_ref(),mode,move_state,body,touching,run,mode_state,models,hitbox_mesh,bvh,style,camera,input_state,time);
@@ -1587,21 +1602,6 @@ fn collision_start_contact(
 			}
 		}
 	}
-	match &attr.general.trajectory{
-		Some(trajectory)=>{
-			match trajectory{
-				gameplay_attributes::SetTrajectory::AirTime(_)=>todo!(),
-				gameplay_attributes::SetTrajectory::Height(_)=>todo!(),
-				gameplay_attributes::SetTrajectory::TargetPointTime { target_point: _, time: _ }=>todo!(),
-				gameplay_attributes::SetTrajectory::TargetPointSpeed { target_point: _, speed: _, trajectory_choice: _ }=>todo!(),
-				&gameplay_attributes::SetTrajectory::Velocity(velocity)=>{
-					move_state.cull_velocity(velocity,body,touching,models,hitbox_mesh,style,camera,input_state);
-				},
-				gameplay_attributes::SetTrajectory::DotVelocity { direction: _, dot: _ }=>todo!(),
-			}
-		},
-		None=>(),
-	}
 	//doing enum to set the acceleration when surfing
 	//doing input_and_body to refresh the walk state if you hit a wall while accelerating
 	move_state.apply_enum_and_input_and_body(body,touching,models,hitbox_mesh,style,camera,input_state);