This commit is contained in:
Quaternions 2024-02-21 04:12:08 -08:00
parent 623a2d2a4f
commit eb34cce746
3 changed files with 16 additions and 0 deletions

View File

@ -46,6 +46,7 @@ pub enum PhysicsInputInstruction {
//Idle: there were no input events, but the simulation is safe to advance to this timestep //Idle: there were no input events, but the simulation is safe to advance to this timestep
//for interpolation / networking / playback reasons, most playback heads will always want //for interpolation / networking / playback reasons, most playback heads will always want
//to be 1 instruction ahead to generate the next state for interpolation. //to be 1 instruction ahead to generate the next state for interpolation.
PracticeFly,
} }
#[derive(Clone,Copy,Debug,Default,Hash)] #[derive(Clone,Copy,Debug,Default,Hash)]
@ -1484,6 +1485,18 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
state.move_state=MoveState::Air; state.move_state=MoveState::Air;
//b_refresh_walk_target will figure out gravity and stuff //b_refresh_walk_target will figure out gravity and stuff
}, },
PhysicsInputInstruction::PracticeFly=>{
match &state.move_state{
MoveState::Fly=>{
state.move_state=MoveState::Air;
state.body.acceleration=state.style.gravity;
},
_=>{
state.move_state=MoveState::Fly;
state.body.acceleration=Planar64Vec3::ZERO;
},
}
},
PhysicsInputInstruction::Idle=>{b_refresh_walk_target=false;},//literally idle! PhysicsInputInstruction::Idle=>{b_refresh_walk_target=false;},//literally idle!
} }
if b_refresh_walk_target{ if b_refresh_walk_target{

View File

@ -13,6 +13,7 @@ pub enum InputInstruction{
Jump(bool), Jump(bool),
Zoom(bool), Zoom(bool),
Reset, Reset,
PracticeFly,
} }
pub enum Instruction{ pub enum Instruction{
Input(InputInstruction), Input(InputInstruction),
@ -62,6 +63,7 @@ pub enum Instruction{
&InputInstruction::Jump(s)=>Some(PhysicsInputInstruction::SetJump(s)), &InputInstruction::Jump(s)=>Some(PhysicsInputInstruction::SetJump(s)),
&InputInstruction::Zoom(s)=>Some(PhysicsInputInstruction::SetZoom(s)), &InputInstruction::Zoom(s)=>Some(PhysicsInputInstruction::SetZoom(s)),
InputInstruction::Reset=>Some(PhysicsInputInstruction::Reset), InputInstruction::Reset=>Some(PhysicsInputInstruction::Reset),
InputInstruction::PracticeFly=>Some(PhysicsInputInstruction::PracticeFly),
}, },
Instruction::GenerateModels(_)=>Some(PhysicsInputInstruction::Idle), Instruction::GenerateModels(_)=>Some(PhysicsInputInstruction::Idle),
Instruction::ClearModels=>Some(PhysicsInputInstruction::Idle), Instruction::ClearModels=>Some(PhysicsInputInstruction::Idle),

View File

@ -108,6 +108,7 @@ impl WindowContext<'_>{
"q"=>Some(InputInstruction::MoveDown(s)), "q"=>Some(InputInstruction::MoveDown(s)),
"z"=>Some(InputInstruction::Zoom(s)), "z"=>Some(InputInstruction::Zoom(s)),
"r"=>if s{Some(InputInstruction::Reset)}else{None}, "r"=>if s{Some(InputInstruction::Reset)}else{None},
"f"=>if s{Some(InputInstruction::PracticeFly)}else{None},
_=>None, _=>None,
}, },
_=>None, _=>None,