summaryrefslogtreecommitdiff
path: root/engine-ecs/src/component.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src/component.rs')
-rw-r--r--engine-ecs/src/component.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs
index 9220ffb..cbd45e7 100644
--- a/engine-ecs/src/component.rs
+++ b/engine-ecs/src/component.rs
@@ -294,6 +294,7 @@ pub struct Parts
{
pub id: Uid,
pub name: &'static str,
+ pub is_sole: bool,
pub type_reflection: Option<&'static TypeReflection>,
pub data: Box<dyn Any>,
pub pair_relation_metadata: Option<PairMemberMetadata>,
@@ -313,6 +314,7 @@ impl Parts
pub struct PartsBuilder
{
name: &'static str,
+ is_sole: bool,
type_reflection: Option<&'static TypeReflection>,
pair_relation_metadata: Option<PairMemberMetadata>,
pair_target_metadata: Option<PairMemberMetadata>,
@@ -328,6 +330,13 @@ impl PartsBuilder
}
#[must_use]
+ pub fn is_sole(mut self, is_sole: bool) -> Self
+ {
+ self.is_sole = is_sole;
+ self
+ }
+
+ #[must_use]
pub fn type_reflection(
mut self,
type_reflection: Option<&'static TypeReflection>,
@@ -338,20 +347,15 @@ impl PartsBuilder
}
#[must_use]
- pub fn pair_relation_metadata(
- mut self,
- metadata: Option<PairMemberMetadata>,
- ) -> Self
+ pub fn pair_relation_metadata(mut self, metadata: Option<PairMemberMetadata>)
+ -> Self
{
self.pair_relation_metadata = metadata;
self
}
#[must_use]
- pub fn pair_target_metadata(
- mut self,
- metadata: Option<PairMemberMetadata>,
- ) -> Self
+ pub fn pair_target_metadata(mut self, metadata: Option<PairMemberMetadata>) -> Self
{
self.pair_target_metadata = metadata;
self
@@ -363,6 +367,7 @@ impl PartsBuilder
Parts {
id,
name: self.name,
+ is_sole: self.is_sole,
type_reflection: self.type_reflection,
data: Box::new(data),
pair_relation_metadata: self.pair_relation_metadata,
@@ -376,6 +381,7 @@ impl PartsBuilder
Parts {
id,
name: self.name,
+ is_sole: self.is_sole,
type_reflection: self.type_reflection,
data,
pair_relation_metadata: self.pair_relation_metadata,
@@ -390,6 +396,7 @@ impl Default for PartsBuilder
{
Self {
name: "(unspecified)",
+ is_sole: false,
type_reflection: None,
pair_relation_metadata: None,
pair_target_metadata: None,
@@ -404,4 +411,5 @@ pub struct Info
pub type_reflection: Option<&'static TypeReflection>,
pub ty_id: TypeId,
pub name: &'static str,
+ pub is_sole: bool,
}