boiling wip

This commit is contained in:
Quaternions 2024-07-25 11:32:58 -07:00
parent a18c56f235
commit d4e3235935
3 changed files with 194 additions and 0 deletions

View File

@ -13,3 +13,11 @@ impl Into<strafesnet_common::aabb::Aabb> for Aabb{
) )
} }
} }
impl From<strafesnet_common::aabb::Aabb> for Aabb{
fn from(value:strafesnet_common::aabb::Aabb)->Self{
Self{
max:value.max().get().to_array(),
min:value.min().get().to_array(),
}
}
}

View File

@ -12,6 +12,16 @@ impl Into<strafesnet_common::gameplay_attributes::ContactingLadder> for Contacti
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::ContactingLadder> for ContactingLadder{
fn from(value:strafesnet_common::gameplay_attributes::ContactingLadder)->Self{
Self{
sticky:match value.sticky{
true=>Some(()),
false=>None,
}
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -40,6 +50,24 @@ impl Into<strafesnet_common::gameplay_attributes::ContactingBehaviour> for Conta
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::ContactingBehaviour> for ContactingBehaviour{
fn from(value:strafesnet_common::gameplay_attributes::ContactingBehaviour)->Self{
match value{
strafesnet_common::gameplay_attributes::ContactingBehaviour::Surf=>
ContactingBehaviour::Surf,
strafesnet_common::gameplay_attributes::ContactingBehaviour::Ladder(contacting_ladder)=>
ContactingBehaviour::Ladder(
contacting_ladder.into()
),
strafesnet_common::gameplay_attributes::ContactingBehaviour::NoJump=>
ContactingBehaviour::NoJump,
strafesnet_common::gameplay_attributes::ContactingBehaviour::Cling=>
ContactingBehaviour::Cling,
strafesnet_common::gameplay_attributes::ContactingBehaviour::Elastic(elasticity)=>
ContactingBehaviour::Elastic(elasticity),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -57,6 +85,15 @@ impl Into<strafesnet_common::gameplay_attributes::IntersectingWater> for Interse
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::IntersectingWater> for IntersectingWater{
fn from(value:strafesnet_common::gameplay_attributes::IntersectingWater)->Self{
Self{
viscosity:value.viscosity.get(),
density:value.density.get(),
velocity:value.velocity.get().to_array(),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -70,6 +107,13 @@ impl Into<strafesnet_common::gameplay_attributes::Accelerator> for Accelerator{
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::Accelerator> for Accelerator{
fn from(value:strafesnet_common::gameplay_attributes::Accelerator)->Self{
Self{
acceleration:value.acceleration.get().to_array(),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -92,6 +136,19 @@ impl Into<strafesnet_common::gameplay_attributes::Booster> for Booster{
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::Booster> for Booster{
fn from(value:strafesnet_common::gameplay_attributes::Booster)->Self{
match value{
strafesnet_common::gameplay_attributes::Booster::Velocity(velocity)=>
Booster::Velocity(velocity.get().to_array()),
strafesnet_common::gameplay_attributes::Booster::Energy{direction,energy}=>
Booster::Energy{
direction:direction.get().to_array(),
energy:energy.get(),
},
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little,repr=u8)] #[brw(little,repr=u8)]
@ -109,6 +166,16 @@ impl Into<strafesnet_common::gameplay_attributes::TrajectoryChoice> for Trajecto
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::TrajectoryChoice> for TrajectoryChoice{
fn from(value:strafesnet_common::gameplay_attributes::TrajectoryChoice)->Self{
match value{
strafesnet_common::gameplay_attributes::TrajectoryChoice::HighArcLongDuration=>
TrajectoryChoice::HighArcLongDuration,
strafesnet_common::gameplay_attributes::TrajectoryChoice::LowArcShortDuration=>
TrajectoryChoice::LowArcShortDuration,
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -161,6 +228,40 @@ impl Into<strafesnet_common::gameplay_attributes::SetTrajectory> for SetTrajecto
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::SetTrajectory> for SetTrajectory{
fn from(value:strafesnet_common::gameplay_attributes::SetTrajectory)->Self{
match value{
strafesnet_common::gameplay_attributes::SetTrajectory::AirTime(time)=>
SetTrajectory::AirTime(
time.get()
),
strafesnet_common::gameplay_attributes::SetTrajectory::Height(height)=>
SetTrajectory::Height(
height.get()
),
strafesnet_common::gameplay_attributes::SetTrajectory::DotVelocity{direction,dot}=>
SetTrajectory::DotVelocity{
direction:direction.get().to_array(),
dot:dot.get(),
},
strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointTime{target_point,time}=>
SetTrajectory::TargetPointTime{
target_point:target_point.get().to_array(),
time:time.get(),
},
strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointSpeed{target_point,speed,trajectory_choice}=>
SetTrajectory::TargetPointSpeed{
target_point:target_point.get().to_array(),
speed:speed.get(),
trajectory_choice:trajectory_choice.into(),
},
strafesnet_common::gameplay_attributes::SetTrajectory::Velocity(velocity)=>
SetTrajectory::Velocity(
velocity.get().to_array()
),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -174,6 +275,13 @@ impl Into<strafesnet_common::gameplay_attributes::Wormhole> for Wormhole{
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::Wormhole> for Wormhole{
fn from(value:strafesnet_common::gameplay_attributes::Wormhole)->Self{
Self{
destination_model:value.destination_model.get(),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -193,6 +301,16 @@ impl Into<strafesnet_common::gameplay_attributes::GeneralAttributes> for General
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::GeneralAttributes> for GeneralAttributes{
fn from(value:strafesnet_common::gameplay_attributes::GeneralAttributes)->Self{
Self{
booster:value.booster.map(Into::into),
trajectory:value.trajectory.map(Into::into),
wormhole:value.wormhole.map(Into::into),
accelerator:value.accelerator.map(Into::into),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -206,6 +324,13 @@ impl Into<strafesnet_common::gameplay_attributes::ContactingAttributes> for Cont
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::ContactingAttributes> for ContactingAttributes{
fn from(value:strafesnet_common::gameplay_attributes::ContactingAttributes)->Self{
Self{
contact_behaviour:value.contact_behaviour.map(Into::into),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -219,6 +344,14 @@ impl Into<strafesnet_common::gameplay_attributes::IntersectingAttributes> for In
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::IntersectingAttributes> for IntersectingAttributes{
fn from(value:strafesnet_common::gameplay_attributes::IntersectingAttributes)->Self{
Self{
water:value.water.map(Into::into),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
pub enum CollisionAttributes{ pub enum CollisionAttributes{
@ -244,3 +377,15 @@ impl Into<strafesnet_common::gameplay_attributes::CollisionAttributes> for Colli
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::CollisionAttributes> for CollisionAttributes{
fn from(value:strafesnet_common::gameplay_attributes::CollisionAttributes)->Self{
match value{
strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration=>
CollisionAttributes::Decoration,
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact{contacting,general}=>
CollisionAttributes::Contact{contacting:contacting.into(),general:general.into()},
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect{intersecting,general}=>
CollisionAttributes::Intersect{intersecting:intersecting.into(),general:general.into()},
}
}
}

View File

@ -22,6 +22,18 @@ impl Into<strafesnet_common::gameplay_modes::StageElementBehaviour> for StageEle
} }
} }
} }
impl From<strafesnet_common::gameplay_modes::StageElementBehaviour> for StageElementBehaviour{
fn from(value:strafesnet_common::gameplay_modes::StageElementBehaviour)->Self{
match value{
strafesnet_common::gameplay_modes::StageElementBehaviour::SpawnAt=>StageElementBehaviour::SpawnAt,
strafesnet_common::gameplay_modes::StageElementBehaviour::Trigger=>StageElementBehaviour::Trigger,
strafesnet_common::gameplay_modes::StageElementBehaviour::Teleport=>StageElementBehaviour::Teleport,
strafesnet_common::gameplay_modes::StageElementBehaviour::Platform=>StageElementBehaviour::Platform,
strafesnet_common::gameplay_modes::StageElementBehaviour::Check=>StageElementBehaviour::Check,
strafesnet_common::gameplay_modes::StageElementBehaviour::Checkpoint=>StageElementBehaviour::Checkpoint,
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -41,6 +53,16 @@ impl Into<strafesnet_common::gameplay_modes::StageElement> for StageElement{
) )
} }
} }
impl From<strafesnet_common::gameplay_modes::StageElement> for StageElement{
fn from(value:strafesnet_common::gameplay_modes::StageElement)->Self{
Self{
stage_id:value.stage_id().get(),
behaviour:value.behaviour().into(),
jump_limit:value.jump_limit(),
force:match value.force(){true=>Some(()),false=>None},
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
@ -71,6 +93,25 @@ impl Into<strafesnet_common::gameplay_modes::Stage> for Stage{
) )
} }
} }
impl From<strafesnet_common::gameplay_modes::Stage> for Stage{
fn from(value:strafesnet_common::gameplay_modes::Stage)->Self{
let spawn=value.spawn().get();
let ordered_checkpoints_count=value.ordered_checkpoints_count();
let unordered_checkpoints_count=value.unordered_checkpoints_count();
let (ordered_checkpoints,unordered_checkpoints)=value.into_inner();
Self{
spawn,
ordered_checkpoints_count,
unordered_checkpoints_count,
ordered_checkpoints:ordered_checkpoints.into_iter()
.map(|(checkpoint_id,model_id)|(checkpoint_id.get(),model_id.get()))
.collect(),
unordered_checkpoints:unordered_checkpoints.into_iter()
.map(|model_id|model_id.get())
.collect(),
}
}
}
#[binrw::binrw] #[binrw::binrw]
#[brw(little,repr=u8)] #[brw(little,repr=u8)]