prevent hitting side of spawn from updating current stage
This commit is contained in:
parent
3991cb5064
commit
62dfe23539
@ -1583,6 +1583,18 @@ fn run_teleport_behaviour(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn not_spawn_at(
|
||||||
|
mode:Option<&gameplay_modes::Mode>,
|
||||||
|
model_id:ModelId,
|
||||||
|
)->bool{
|
||||||
|
if let Some(mode)=mode{
|
||||||
|
if let Some(stage_element)=mode.get_element(model_id){
|
||||||
|
return stage_element.behaviour()!=gameplay_modes::StageElementBehaviour::SpawnAt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
fn collision_start_contact(
|
fn collision_start_contact(
|
||||||
move_state:&mut MoveState,
|
move_state:&mut MoveState,
|
||||||
body:&mut Body,
|
body:&mut Body,
|
||||||
@ -1605,6 +1617,8 @@ fn collision_start_contact(
|
|||||||
touching.insert(Collision::Contact(contact));
|
touching.insert(Collision::Contact(contact));
|
||||||
//clip v
|
//clip v
|
||||||
set_velocity(body,touching,models,hitbox_mesh,incident_velocity);
|
set_velocity(body,touching,models,hitbox_mesh,incident_velocity);
|
||||||
|
let model_id=contact.model_id.into();
|
||||||
|
let mut allow_run_teleport_behaviour=not_spawn_at(mode,model_id);
|
||||||
match &attr.contacting.contact_behaviour{
|
match &attr.contacting.contact_behaviour{
|
||||||
Some(gameplay_attributes::ContactingBehaviour::Surf)=>println!("I'm surfing!"),
|
Some(gameplay_attributes::ContactingBehaviour::Surf)=>println!("I'm surfing!"),
|
||||||
Some(gameplay_attributes::ContactingBehaviour::Cling)=>println!("Unimplemented!"),
|
Some(gameplay_attributes::ContactingBehaviour::Cling)=>println!("Unimplemented!"),
|
||||||
@ -1628,6 +1642,7 @@ fn collision_start_contact(
|
|||||||
Some(gameplay_attributes::ContactingBehaviour::NoJump)=>todo!("nyi"),
|
Some(gameplay_attributes::ContactingBehaviour::NoJump)=>todo!("nyi"),
|
||||||
None=>if let Some(walk_settings)=&style.walk{
|
None=>if let Some(walk_settings)=&style.walk{
|
||||||
if walk_settings.is_slope_walkable(contact_normal(models,hitbox_mesh,&contact),vec3::Y){
|
if walk_settings.is_slope_walkable(contact_normal(models,hitbox_mesh,&contact),vec3::Y){
|
||||||
|
allow_run_teleport_behaviour=true;
|
||||||
//ground
|
//ground
|
||||||
let (gravity,target_velocity)=ground_things(walk_settings,&contact,touching,models,hitbox_mesh,style,camera,input_state);
|
let (gravity,target_velocity)=ground_things(walk_settings,&contact,touching,models,hitbox_mesh,style,camera,input_state);
|
||||||
let walk_state=ContactMoveState::ground(walk_settings,body,gravity,target_velocity,contact);
|
let walk_state=ContactMoveState::ground(walk_settings,body,gravity,target_velocity,contact);
|
||||||
@ -1636,7 +1651,9 @@ fn collision_start_contact(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
//I love making functions with 10 arguments to dodge the borrow checker
|
//I love making functions with 10 arguments to dodge the borrow checker
|
||||||
run_teleport_behaviour(contact.model_id.into(),attr.general.wormhole.as_ref(),mode,move_state,body,touching,run,mode_state,models,hitbox_mesh,bvh,style,camera,input_state,time);
|
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);
|
||||||
|
}
|
||||||
if style.get_control(Controls::Jump,input_state.controls){
|
if style.get_control(Controls::Jump,input_state.controls){
|
||||||
if let (Some(jump_settings),Some(walk_state))=(&style.jump,move_state.get_walk_state()){
|
if let (Some(jump_settings),Some(walk_state))=(&style.jump,move_state.get_walk_state()){
|
||||||
let jump_dir=walk_state.jump_direction.direction(models,hitbox_mesh,&walk_state.contact);
|
let jump_dir=walk_state.jump_direction.direction(models,hitbox_mesh,&walk_state.contact);
|
||||||
|
Loading…
Reference in New Issue
Block a user