update common

This commit is contained in:
Quaternions 2024-08-09 14:13:10 -07:00
parent a31bb6c095
commit 6a198ad746
3 changed files with 59 additions and 19 deletions

4
Cargo.lock generated
View File

@ -99,9 +99,9 @@ dependencies = [
[[package]]
name = "strafesnet_common"
version = "0.3.0"
version = "0.4.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "1077d45a0b064964906a57de765a5a2bfe47b41f2f807d13b18c70765e76d3dd"
checksum = "ea4126f6fbf9aecf89c9e319290f0221d177dcaa8659b4b9e3d82acc37829f12"
dependencies = [
"arrayvec",
"bitflags",

View File

@ -8,4 +8,4 @@ edition = "2021"
[dependencies]
binrw = "0.14.0"
id = { version = "0.1.0", registry = "strafesnet" }
strafesnet_common = { version = "0.3.0", registry = "strafesnet" }
strafesnet_common = { version = "0.4.0", registry = "strafesnet" }

View File

@ -409,31 +409,71 @@ impl From<strafesnet_common::gameplay_attributes::IntersectingAttributes> for In
}
}
#[binrw::binrw]
#[brw(little)]
pub struct ContactAttributes{
contacting:ContactingAttributes,
general:GeneralAttributes,
}
impl Into<strafesnet_common::gameplay_attributes::ContactAttributes> for ContactAttributes{
fn into(self)->strafesnet_common::gameplay_attributes::ContactAttributes{
strafesnet_common::gameplay_attributes::ContactAttributes{
contacting:self.contacting.into(),
general:self.general.into(),
}
}
}
impl From<strafesnet_common::gameplay_attributes::ContactAttributes> for ContactAttributes{
fn from(value:strafesnet_common::gameplay_attributes::ContactAttributes)->Self{
Self{
contacting:value.contacting.into(),
general:value.general.into(),
}
}
}
#[binrw::binrw]
#[brw(little)]
pub struct IntersectAttributes{
intersecting:IntersectingAttributes,
general:GeneralAttributes,
}
impl Into<strafesnet_common::gameplay_attributes::IntersectAttributes> for IntersectAttributes{
fn into(self)->strafesnet_common::gameplay_attributes::IntersectAttributes{
strafesnet_common::gameplay_attributes::IntersectAttributes{
intersecting:self.intersecting.into(),
general:self.general.into(),
}
}
}
impl From<strafesnet_common::gameplay_attributes::IntersectAttributes> for IntersectAttributes{
fn from(value:strafesnet_common::gameplay_attributes::IntersectAttributes)->Self{
Self{
intersecting:value.intersecting.into(),
general:value.general.into(),
}
}
}
#[binrw::binrw]
#[brw(little)]
pub enum CollisionAttributes{
#[brw(magic=0u8)]
Decoration,
#[brw(magic=1u8)]
Contact{
contacting:ContactingAttributes,
general:GeneralAttributes,
},
Contact(ContactAttributes),
#[brw(magic=2u8)]
Intersect{
intersecting:IntersectingAttributes,
general:GeneralAttributes,
},
Intersect(IntersectAttributes),
}
impl Into<strafesnet_common::gameplay_attributes::CollisionAttributes> for CollisionAttributes{
fn into(self)->strafesnet_common::gameplay_attributes::CollisionAttributes{
match self{
CollisionAttributes::Decoration=>
strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration,
CollisionAttributes::Contact{contacting,general}=>
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact{contacting:contacting.into(),general:general.into()},
CollisionAttributes::Intersect{intersecting,general}=>
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect{intersecting:intersecting.into(),general:general.into()},
CollisionAttributes::Contact(attr)=>
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact(attr.into()),
CollisionAttributes::Intersect(attr)=>
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect(attr.into()),
}
}
}
@ -442,10 +482,10 @@ impl From<strafesnet_common::gameplay_attributes::CollisionAttributes> for Colli
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()},
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact(attr)=>
CollisionAttributes::Contact(attr.into()),
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect(attr)=>
CollisionAttributes::Intersect(attr.into()),
}
}
}