This commit is contained in:
Quaternions 2024-07-25 12:08:01 -07:00
parent c786392275
commit 7479a67e29

View File

@ -54,6 +54,15 @@ impl Into<strafesnet_common::gameplay_style::JumpCalculation> for JumpCalculatio
}
}
}
impl From<strafesnet_common::gameplay_style::JumpCalculation> for JumpCalculation{
fn from(value:strafesnet_common::gameplay_style::JumpCalculation)->Self{
match value{
strafesnet_common::gameplay_style::JumpCalculation::Capped=>JumpCalculation::Capped,
strafesnet_common::gameplay_style::JumpCalculation::Energy=>JumpCalculation::Energy,
strafesnet_common::gameplay_style::JumpCalculation::Linear=>JumpCalculation::Linear,
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -73,6 +82,16 @@ impl Into<strafesnet_common::gameplay_style::JumpImpulse> for JumpImpulse{
}
}
}
impl From<strafesnet_common::gameplay_style::JumpImpulse> for JumpImpulse{
fn from(value:strafesnet_common::gameplay_style::JumpImpulse)->Self{
match value{
strafesnet_common::gameplay_style::JumpImpulse::FromTime(time)=>JumpImpulse::FromTime(time.get()),
strafesnet_common::gameplay_style::JumpImpulse::FromHeight(height)=>JumpImpulse::FromHeight(height.get()),
strafesnet_common::gameplay_style::JumpImpulse::FromDeltaV(deltav)=>JumpImpulse::FromDeltaV(deltav.get()),
strafesnet_common::gameplay_style::JumpImpulse::FromEnergy(energy)=>JumpImpulse::FromEnergy(energy.get()),
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -90,6 +109,15 @@ impl Into<strafesnet_common::gameplay_style::ControlsActivation> for ControlsAct
)
}
}
impl From<strafesnet_common::gameplay_style::ControlsActivation> for ControlsActivation{
fn from(value:strafesnet_common::gameplay_style::ControlsActivation)->Self{
Self{
controls_mask:value.controls_mask().bits(),
controls_intersects:value.controls_intersects().bits(),
controls_contains:value.controls_contains().bits(),
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -109,6 +137,17 @@ impl Into<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
)
}
}
impl From<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
fn from(value:strafesnet_common::gameplay_style::StrafeSettings)->Self{
let (enable,mv,air_accel_limit,tick_rate)=value.into_inner();
Self{
enable:enable.into(),
mv:mv.get(),
air_accel_limit:air_accel_limit.map(|a|a.get()),
tick_rate:tick_rate.into(),
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -122,6 +161,13 @@ impl Into<strafesnet_common::gameplay_style::PropulsionSettings> for PropulsionS
)
}
}
impl From<strafesnet_common::gameplay_style::PropulsionSettings> for PropulsionSettings{
fn from(value:strafesnet_common::gameplay_style::PropulsionSettings)->Self{
Self{
magnitude:value.magnitude().get(),
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -137,6 +183,15 @@ impl Into<strafesnet_common::gameplay_style::JumpSettings> for JumpSettings{
)
}
}
impl From<strafesnet_common::gameplay_style::JumpSettings> for JumpSettings{
fn from(value:strafesnet_common::gameplay_style::JumpSettings)->Self{
let (impulse,calculation)=value.into_inner();
Self{
impulse:impulse.into(),
calculation:calculation.into(),
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -152,6 +207,14 @@ impl Into<strafesnet_common::gameplay_style::AccelerateSettings> for AccelerateS
)
}
}
impl From<strafesnet_common::gameplay_style::AccelerateSettings> for AccelerateSettings{
fn from(value:strafesnet_common::gameplay_style::AccelerateSettings)->Self{
Self{
accel:value.accel().get(),
topspeed:value.topspeed().get(),
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -171,6 +234,17 @@ impl Into<strafesnet_common::gameplay_style::WalkSettings> for WalkSettings{
)
}
}
impl From<strafesnet_common::gameplay_style::WalkSettings> for WalkSettings{
fn from(value:strafesnet_common::gameplay_style::WalkSettings)->Self{
let (accelerate,static_friction,kinetic_friction,surf_dot)=value.into_inner();
Self{
accelerate:accelerate.into(),
static_friction:static_friction.get(),
kinetic_friction:kinetic_friction.get(),
surf_dot:surf_dot.get(),
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -186,6 +260,15 @@ impl Into<strafesnet_common::gameplay_style::LadderSettings> for LadderSettings{
)
}
}
impl From<strafesnet_common::gameplay_style::LadderSettings> for LadderSettings{
fn from(value:strafesnet_common::gameplay_style::LadderSettings)->Self{
let (accelerate,dot)=value.into_inner();
Self{
accelerate:accelerate.into(),
dot:dot.get(),
}
}
}
#[binrw::binrw]
#[brw(little,repr=u8)]
@ -201,6 +284,14 @@ impl Into<strafesnet_common::gameplay_style::HitboxMesh> for HitboxMesh{
}
}
}
impl From<strafesnet_common::gameplay_style::HitboxMesh> for HitboxMesh{
fn from(value:strafesnet_common::gameplay_style::HitboxMesh)->Self{
match value{
strafesnet_common::gameplay_style::HitboxMesh::Box=>HitboxMesh::Box,
strafesnet_common::gameplay_style::HitboxMesh::Cylinder=>HitboxMesh::Cylinder,
}
}
}
#[binrw::binrw]
#[brw(little)]
@ -216,3 +307,11 @@ impl Into<strafesnet_common::gameplay_style::Hitbox> for Hitbox{
}
}
}
impl From<strafesnet_common::gameplay_style::Hitbox> for Hitbox{
fn from(value:strafesnet_common::gameplay_style::Hitbox)->Self{
Self{
halfsize:value.halfsize.get().to_array(),
mesh:value.mesh.into(),
}
}
}