diff --git a/src/newtypes/gameplay_style.rs b/src/newtypes/gameplay_style.rs index 71c8320..1ce63bb 100644 --- a/src/newtypes/gameplay_style.rs +++ b/src/newtypes/gameplay_style.rs @@ -54,6 +54,15 @@ impl Into for JumpCalculatio } } } +impl From 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 for JumpImpulse{ } } } +impl From 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 for ControlsAct ) } } +impl From 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 for StrafeSettings{ ) } } +impl From 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 for PropulsionS ) } } +impl From 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 for JumpSettings{ ) } } +impl From 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 for AccelerateS ) } } +impl From 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 for WalkSettings{ ) } } +impl From 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 for LadderSettings{ ) } } +impl From 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 for HitboxMesh{ } } } +impl From 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 for Hitbox{ } } } +impl From for Hitbox{ + fn from(value:strafesnet_common::gameplay_style::Hitbox)->Self{ + Self{ + halfsize:value.halfsize.get().to_array(), + mesh:value.mesh.into(), + } + } +}