pub struct YoleckEntityType {
pub name: String,
pub has_uuid: bool,
/* private fields */
}
Expand description
A type of entity that can be created and edited with the Yoleck level editor.
Yoleck will only read and write the components registered on the entity type with the
with
method, even if the file has data of other components or if
the Bevy entity has other YoleckComponent
s inserted to it. These components will still take
effect in edit and populate systems though, even if they are not registered on the entity.
Fields§
§name: String
The type_name
used to identify the entity type.
has_uuid: bool
Implementations§
Source§impl YoleckEntityType
impl YoleckEntityType
pub fn new(name: impl ToString) -> Self
Sourcepub fn with<T: YoleckComponent>(self) -> Self
pub fn with<T: YoleckComponent>(self) -> Self
Register a YoleckComponent
for entities of this type.
Sourcepub fn insert_on_init<T: Bundle>(
self,
bundle_maker: impl 'static + Sync + Send + Fn() -> T,
) -> Self
pub fn insert_on_init<T: Bundle>( self, bundle_maker: impl 'static + Sync + Send + Fn() -> T, ) -> Self
Automatically spawn regular Bevy components when creating entities of this type.
This is useful for marker components that don’t carry data that needs to be saved to files.
Sourcepub fn insert_on_init_during_editor<T: Bundle>(
self,
bundle_maker: impl 'static + Sync + Send + Fn() -> T,
) -> Self
pub fn insert_on_init_during_editor<T: Bundle>( self, bundle_maker: impl 'static + Sync + Send + Fn() -> T, ) -> Self
Similar to insert_on_init
, but only applies for entities in the
editor. Will not be added during playtests or actual game.
Sourcepub fn insert_on_init_during_game<T: Bundle>(
self,
bundle_maker: impl 'static + Sync + Send + Fn() -> T,
) -> Self
pub fn insert_on_init_during_game<T: Bundle>( self, bundle_maker: impl 'static + Sync + Send + Fn() -> T, ) -> Self
Similar to insert_on_init
, but only applies for entities in
playtests or the actual game. Will not be added in the editor.
Sourcepub fn with_uuid(self) -> Self
pub fn with_uuid(self) -> Self
Give the entity a UUID, so that it can be persistently referred in .yol
files.
These entities will have a uuid
field in their record header in the .yol
file, and a
YoleckEntityUuid
component that stores the same UUID
when loaded. The YoleckUuidRegistry
resource can be
used to resolve the entity from the UUID.
Auto Trait Implementations§
impl Freeze for YoleckEntityType
impl !RefUnwindSafe for YoleckEntityType
impl Send for YoleckEntityType
impl Sync for YoleckEntityType
impl Unpin for YoleckEntityType
impl !UnwindSafe for YoleckEntityType
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more