unused argument

This commit is contained in:
Quaternions 2024-02-21 22:28:33 -08:00
parent 8f606b7cfc
commit 5a55aefb4f

View File

@ -170,13 +170,13 @@ impl TransientAcceleration{
} }
} }
} }
fn ground(walk_settings:&gameplay_style::WalkSettings,body:&Body,gravity:Planar64Vec3,target_velocity:Planar64Vec3,normal:Planar64Vec3)->Self{ fn ground(walk_settings:&gameplay_style::WalkSettings,body:&Body,gravity:Planar64Vec3,target_velocity:Planar64Vec3)->Self{
let target_diff=target_velocity-body.velocity; let target_diff=target_velocity-body.velocity;
//precalculate accel //precalculate accel
let accel=walk_settings.accel(target_diff,gravity); let accel=walk_settings.accel(target_diff,gravity);
Self::with_target_diff(target_diff,accel,body.time) Self::with_target_diff(target_diff,accel,body.time)
} }
fn ladder(ladder_settings:&gameplay_style::LadderSettings,body:&Body,gravity:Planar64Vec3,target_velocity:Planar64Vec3,normal:Planar64Vec3)->Self{ fn ladder(ladder_settings:&gameplay_style::LadderSettings,body:&Body,gravity:Planar64Vec3,target_velocity:Planar64Vec3)->Self{
let target_diff=target_velocity-body.velocity; let target_diff=target_velocity-body.velocity;
let accel=ladder_settings.accel(target_diff,gravity); let accel=ladder_settings.accel(target_diff,gravity);
Self::with_target_diff(target_diff,accel,body.time) Self::with_target_diff(target_diff,accel,body.time)
@ -190,36 +190,36 @@ impl TransientAcceleration{
} }
} }
impl ContactMoveState{ impl ContactMoveState{
fn ground(walk_settings:&gameplay_style::WalkSettings,body:&Body,gravity:Planar64Vec3,target_velocity:Planar64Vec3,contact:ContactCollision,normal:Planar64Vec3)->Self{ fn ground(walk_settings:&gameplay_style::WalkSettings,body:&Body,gravity:Planar64Vec3,target_velocity:Planar64Vec3,contact:ContactCollision)->Self{
Self{ Self{
target:TransientAcceleration::ground(walk_settings,body,gravity,target_velocity,normal), target:TransientAcceleration::ground(walk_settings,body,gravity,target_velocity),
contact, contact,
jump_direction:JumpDirection::Exactly(Planar64Vec3::Y), jump_direction:JumpDirection::Exactly(Planar64Vec3::Y),
} }
} }
fn ladder(ladder_settings:&gameplay_style::LadderSettings,body:&Body,gravity:Planar64Vec3,target_velocity:Planar64Vec3,contact:ContactCollision,normal:Planar64Vec3)->Self{ fn ladder(ladder_settings:&gameplay_style::LadderSettings,body:&Body,gravity:Planar64Vec3,target_velocity:Planar64Vec3,contact:ContactCollision)->Self{
Self{//,style,velocity,normal,style.ladder_speed,style.ladder_accel Self{//,style,velocity,normal,style.ladder_speed,style.ladder_accel
target:TransientAcceleration::ladder(ladder_settings,body,gravity,target_velocity,normal), target:TransientAcceleration::ladder(ladder_settings,body,gravity,target_velocity),
contact, contact,
jump_direction:JumpDirection::FromContactNormal, jump_direction:JumpDirection::FromContactNormal,
} }
} }
} }
fn ground_things(walk_settings:&gameplay_style::WalkSettings,contact:&ContactCollision,touching:&TouchingState,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,style:&StyleModifiers,camera:&PhysicsCamera,input_state:&InputState)->(Planar64Vec3,Planar64Vec3,Planar64Vec3){ fn ground_things(walk_settings:&gameplay_style::WalkSettings,contact:&ContactCollision,touching:&TouchingState,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,style:&StyleModifiers,camera:&PhysicsCamera,input_state:&InputState)->(Planar64Vec3,Planar64Vec3){
let normal=contact_normal(models,hitbox_mesh,contact); let normal=contact_normal(models,hitbox_mesh,contact);
let gravity=touching.base_acceleration(models,style,camera,input_state); let gravity=touching.base_acceleration(models,style,camera,input_state);
let control_dir=style.get_y_control_dir(camera,input_state.controls); let control_dir=style.get_y_control_dir(camera,input_state.controls);
let mut target_velocity=walk_settings.get_walk_target_velocity(control_dir,normal); let mut target_velocity=walk_settings.get_walk_target_velocity(control_dir,normal);
touching.constrain_velocity(models,hitbox_mesh,&mut target_velocity); touching.constrain_velocity(models,hitbox_mesh,&mut target_velocity);
(gravity,target_velocity,normal) (gravity,target_velocity)
} }
fn ladder_things(ladder_settings:&gameplay_style::LadderSettings,contact:&ContactCollision,touching:&TouchingState,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,style:&StyleModifiers,camera:&PhysicsCamera,input_state:&InputState)->(Planar64Vec3,Planar64Vec3,Planar64Vec3){ fn ladder_things(ladder_settings:&gameplay_style::LadderSettings,contact:&ContactCollision,touching:&TouchingState,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,style:&StyleModifiers,camera:&PhysicsCamera,input_state:&InputState)->(Planar64Vec3,Planar64Vec3){
let normal=contact_normal(models,hitbox_mesh,contact); let normal=contact_normal(models,hitbox_mesh,contact);
let gravity=touching.base_acceleration(models,style,camera,input_state); let gravity=touching.base_acceleration(models,style,camera,input_state);
let control_dir=style.get_y_control_dir(camera,input_state.controls); let control_dir=style.get_y_control_dir(camera,input_state.controls);
let mut target_velocity=ladder_settings.get_ladder_target_velocity(control_dir,normal); let mut target_velocity=ladder_settings.get_ladder_target_velocity(control_dir,normal);
touching.constrain_velocity(models,hitbox_mesh,&mut target_velocity); touching.constrain_velocity(models,hitbox_mesh,&mut target_velocity);
(gravity,target_velocity,normal) (gravity,target_velocity)
} }
#[derive(Default)] #[derive(Default)]
@ -530,16 +530,16 @@ impl MoveState{
|MoveState::Water=>(), |MoveState::Water=>(),
MoveState::Walk(ContactMoveState{target,contact,jump_direction:_})=>{ MoveState::Walk(ContactMoveState{target,contact,jump_direction:_})=>{
if let Some(walk_settings)=&style.walk{ if let Some(walk_settings)=&style.walk{
let (gravity,target_velocity,normal)=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);
*target=TransientAcceleration::ground(walk_settings,body,gravity,target_velocity,normal); *target=TransientAcceleration::ground(walk_settings,body,gravity,target_velocity);
}else{ }else{
panic!("ContactMoveState exists in style which does not allow walking!"); panic!("ContactMoveState exists in style which does not allow walking!");
} }
}, },
MoveState::Ladder(ContactMoveState{target,contact,jump_direction:_})=>{ MoveState::Ladder(ContactMoveState{target,contact,jump_direction:_})=>{
if let Some(ladder_settings)=&style.ladder{ if let Some(ladder_settings)=&style.ladder{
let (gravity,target_velocity,normal)=ladder_things(ladder_settings,contact,touching,models,hitbox_mesh,style,camera,input_state); let (gravity,target_velocity)=ladder_things(ladder_settings,contact,touching,models,hitbox_mesh,style,camera,input_state);
*target=TransientAcceleration::ladder(ladder_settings,body,gravity,target_velocity,normal); *target=TransientAcceleration::ladder(ladder_settings,body,gravity,target_velocity);
}else{ }else{
panic!("ContactMoveState exists in style which does not allow walking!"); panic!("ContactMoveState exists in style which does not allow walking!");
} }
@ -1325,16 +1325,16 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
set_velocity(&mut state.body,&state.touching,&data.models,&data.hitbox_mesh,Planar64Vec3::ZERO);//model.velocity set_velocity(&mut state.body,&state.touching,&data.models,&data.hitbox_mesh,Planar64Vec3::ZERO);//model.velocity
} }
//ladder walkstate //ladder walkstate
let (gravity,target_velocity,normal)=ladder_things(ladder_settings,&contact,&state.touching,&data.models,&data.hitbox_mesh,&state.style,&state.camera,&state.input_state); let (gravity,target_velocity)=ladder_things(ladder_settings,&contact,&state.touching,&data.models,&data.hitbox_mesh,&state.style,&state.camera,&state.input_state);
let walk_state=ContactMoveState::ladder(ladder_settings,&state.body,gravity,target_velocity,contact,normal); let walk_state=ContactMoveState::ladder(ladder_settings,&state.body,gravity,target_velocity,contact);
state.set_move_state(&data,MoveState::Ladder(walk_state)); state.set_move_state(&data,MoveState::Ladder(walk_state));
}, },
Some(gameplay_attributes::ContactingBehaviour::NoJump)=>todo!("nyi"), Some(gameplay_attributes::ContactingBehaviour::NoJump)=>todo!("nyi"),
None=>if let Some(walk_settings)=&state.style.walk{ None=>if let Some(walk_settings)=&state.style.walk{
if walk_settings.is_slope_walkable(contact_normal(&data.models,&data.hitbox_mesh,&contact),Planar64Vec3::Y){ if walk_settings.is_slope_walkable(contact_normal(&data.models,&data.hitbox_mesh,&contact),Planar64Vec3::Y){
//ground //ground
let (gravity,target_velocity,normal)=ground_things(walk_settings,&contact,&state.touching,&data.models,&data.hitbox_mesh,&state.style,&state.camera,&state.input_state); let (gravity,target_velocity)=ground_things(walk_settings,&contact,&state.touching,&data.models,&data.hitbox_mesh,&state.style,&state.camera,&state.input_state);
let walk_state=ContactMoveState::ground(walk_settings,&state.body,gravity,target_velocity,contact,normal); let walk_state=ContactMoveState::ground(walk_settings,&state.body,gravity,target_velocity,contact);
state.set_move_state(&data,MoveState::Walk(walk_state)); state.set_move_state(&data,MoveState::Walk(walk_state));
} }
}, },