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]] [[package]]
name = "strafesnet_common" name = "strafesnet_common"
version = "0.3.0" version = "0.4.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "1077d45a0b064964906a57de765a5a2bfe47b41f2f807d13b18c70765e76d3dd" checksum = "ea4126f6fbf9aecf89c9e319290f0221d177dcaa8659b4b9e3d82acc37829f12"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",

View File

@ -8,4 +8,4 @@ edition = "2021"
[dependencies] [dependencies]
binrw = "0.14.0" binrw = "0.14.0"
id = { version = "0.1.0", registry = "strafesnet" } 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] #[binrw::binrw]
#[brw(little)] #[brw(little)]
pub enum CollisionAttributes{ pub enum CollisionAttributes{
#[brw(magic=0u8)] #[brw(magic=0u8)]
Decoration, Decoration,
#[brw(magic=1u8)] #[brw(magic=1u8)]
Contact{ Contact(ContactAttributes),
contacting:ContactingAttributes,
general:GeneralAttributes,
},
#[brw(magic=2u8)] #[brw(magic=2u8)]
Intersect{ Intersect(IntersectAttributes),
intersecting:IntersectingAttributes,
general:GeneralAttributes,
},
} }
impl Into<strafesnet_common::gameplay_attributes::CollisionAttributes> for CollisionAttributes{ impl Into<strafesnet_common::gameplay_attributes::CollisionAttributes> for CollisionAttributes{
fn into(self)->strafesnet_common::gameplay_attributes::CollisionAttributes{ fn into(self)->strafesnet_common::gameplay_attributes::CollisionAttributes{
match self{ match self{
CollisionAttributes::Decoration=> CollisionAttributes::Decoration=>
strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration, strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration,
CollisionAttributes::Contact{contacting,general}=> CollisionAttributes::Contact(attr)=>
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact{contacting:contacting.into(),general:general.into()}, strafesnet_common::gameplay_attributes::CollisionAttributes::Contact(attr.into()),
CollisionAttributes::Intersect{intersecting,general}=> CollisionAttributes::Intersect(attr)=>
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect{intersecting:intersecting.into(),general:general.into()}, strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect(attr.into()),
} }
} }
} }
@ -442,10 +482,10 @@ impl From<strafesnet_common::gameplay_attributes::CollisionAttributes> for Colli
match value{ match value{
strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration=> strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration=>
CollisionAttributes::Decoration, CollisionAttributes::Decoration,
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact{contacting,general}=> strafesnet_common::gameplay_attributes::CollisionAttributes::Contact(attr)=>
CollisionAttributes::Contact{contacting:contacting.into(),general:general.into()}, CollisionAttributes::Contact(attr.into()),
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect{intersecting,general}=> strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect(attr)=>
CollisionAttributes::Intersect{intersecting:intersecting.into(),general:general.into()}, CollisionAttributes::Intersect(attr.into()),
} }
} }
} }