fix panic when no modes
This commit is contained in:
parent
ae6e4ee6aa
commit
3b3ccefebb
@ -1315,7 +1315,9 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
//check ground
|
||||
state.touching.insert(c);
|
||||
//I love making functions with 10 arguments to dodge the borrow checker
|
||||
run_teleport_behaviour(&general.wormhole,&data.models,&data.modes.get_mode(state.mode_state.get_mode_id()).unwrap(),&state.style,&data.hitbox_mesh,&mut state.mode_state,&mut state.touching,&mut state.body,convex_mesh_id);
|
||||
if let Some(mode)=data.modes.get_mode(state.mode_state.get_mode_id()){
|
||||
run_teleport_behaviour(&general.wormhole,&data.models,mode,&state.style,&data.hitbox_mesh,&mut state.mode_state,&mut state.touching,&mut state.body,convex_mesh_id);
|
||||
}
|
||||
//flatten v
|
||||
state.touching.constrain_velocity(&data.models,&data.hitbox_mesh,&mut v);
|
||||
match &general.booster{
|
||||
@ -1359,7 +1361,9 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
(PhysicsCollisionAttributes::Intersect{intersecting: _,general},Collision::Intersect(intersect))=>{
|
||||
//I think that setting the velocity to 0 was preventing surface contacts from entering an infinite loop
|
||||
state.touching.insert(c);
|
||||
run_teleport_behaviour(&general.wormhole,&data.models,&data.modes.get_mode(state.mode_state.get_mode_id()).unwrap(),&state.style,&data.hitbox_mesh,&mut state.mode_state,&mut state.touching,&mut state.body,convex_mesh_id);
|
||||
if let Some(mode)=data.modes.get_mode(state.mode_state.get_mode_id()){
|
||||
run_teleport_behaviour(&general.wormhole,&data.models,mode,&state.style,&data.hitbox_mesh,&mut state.mode_state,&mut state.touching,&mut state.body,convex_mesh_id);
|
||||
}
|
||||
},
|
||||
_=>panic!("invalid pair"),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user