pub struct World {
pub id: String,
pub name: String,
pub started: bool,
pub preloading: bool,
pub preload_progress: f32,
/* private fields */
}
Expand description
A voxelize world.
Fields§
§id: String
ID of the world, generated from nanoid!()
.
name: String
Name of the world, used for connection.
started: bool
Whether if the world has started.
preloading: bool
Whether if the world is preloading.
preload_progress: f32
The progress of preloading.
Implementations§
source§impl World
impl World
sourcepub fn new(name: &str, config: &WorldConfig) -> Self
pub fn new(name: &str, config: &WorldConfig) -> Self
Create a new voxelize world.
sourcepub fn read_resource<T: Resource>(&self) -> Fetch<'_, T>
pub fn read_resource<T: Resource>(&self) -> Fetch<'_, T>
Read an ECS resource generically.
sourcepub fn write_resource<T: Resource>(&mut self) -> FetchMut<'_, T>
pub fn write_resource<T: Resource>(&mut self) -> FetchMut<'_, T>
Write an ECS resource generically.
sourcepub fn read_component<T: Component>(&self) -> ReadStorage<'_, T>
pub fn read_component<T: Component>(&self) -> ReadStorage<'_, T>
Read an ECS component storage.
sourcepub fn write_component<T: Component>(&mut self) -> WriteStorage<'_, T>
pub fn write_component<T: Component>(&mut self) -> WriteStorage<'_, T>
Write an ECS component storage.
pub fn set_dispatcher<F: Fn() -> DispatcherBuilder<'static, 'static> + 'static>( &mut self, dispatch: F )
pub fn set_client_modifier<F: Fn(&mut World, Entity) + 'static>( &mut self, modifier: F )
pub fn set_client_parser<F: Fn(&mut World, &str, Entity) + 'static>( &mut self, parser: F )
pub fn set_method_handle<F: Fn(&mut World, &str, &str) + 'static>( &mut self, method: &str, handle: F )
pub fn set_event_handle<F: Fn(&mut World, &str, &str) + 'static>( &mut self, event: &str, handle: F )
pub fn set_transport_handle<F: Fn(&mut World, Value) + 'static>( &mut self, handle: F )
pub fn set_command_handle<F: Fn(&mut World, &str, &str) + 'static>( &mut self, handle: F )
pub fn set_entity_loader<F: Fn(&mut World, MetadataComp) -> EntityBuilder<'_> + 'static>( &mut self, etype: &str, loader: F )
sourcepub fn broadcast(&mut self, data: Message, filter: ClientFilter)
pub fn broadcast(&mut self, data: Message, filter: ClientFilter)
Broadcast a protobuf message to a subset or all of the clients in the world.
sourcepub fn send(&self, addr: &Recipient<EncodedMessage>, data: &Message)
pub fn send(&self, addr: &Recipient<EncodedMessage>, data: &Message)
Send a direct message to an endpoint
sourcepub fn config(&self) -> Fetch<'_, WorldConfig>
pub fn config(&self) -> Fetch<'_, WorldConfig>
Access to the world’s config.
sourcepub fn clients_mut(&mut self) -> FetchMut<'_, Clients>
pub fn clients_mut(&mut self) -> FetchMut<'_, Clients>
Access a mutable clients map in the ECS world.
sourcepub fn chunks_mut(&mut self) -> FetchMut<'_, Chunks>
pub fn chunks_mut(&mut self) -> FetchMut<'_, Chunks>
Access a mutable chunk manager in the ECS world.
sourcepub fn physics_mut(&mut self) -> FetchMut<'_, Physics>
pub fn physics_mut(&mut self) -> FetchMut<'_, Physics>
Access a mutable physics manager in the ECS world.
sourcepub fn chunk_interest(&self) -> Fetch<'_, ChunkInterests>
pub fn chunk_interest(&self) -> Fetch<'_, ChunkInterests>
Access the chunk interests manager in the ECS world.
sourcepub fn chunk_interest_mut(&mut self) -> FetchMut<'_, ChunkInterests>
pub fn chunk_interest_mut(&mut self) -> FetchMut<'_, ChunkInterests>
Access the mutable chunk interest manager in the ECS world.
sourcepub fn events_mut(&mut self) -> FetchMut<'_, Events>
pub fn events_mut(&mut self) -> FetchMut<'_, Events>
Access the mutable events queue in the ECS world.
sourcepub fn search_mut(&mut self) -> FetchMut<'_, Search>
pub fn search_mut(&mut self) -> FetchMut<'_, Search>
Access the mutable search tree in the ECS world.
sourcepub fn stats_mut(&mut self) -> FetchMut<'_, Stats>
pub fn stats_mut(&mut self) -> FetchMut<'_, Stats>
Access the mutable stats manager in the ECS world.
sourcepub fn pipeline_mut(&mut self) -> FetchMut<'_, Pipeline>
pub fn pipeline_mut(&mut self) -> FetchMut<'_, Pipeline>
Access a mutable pipeline management in the ECS world.
sourcepub fn mesher_mut(&mut self) -> FetchMut<'_, Mesher>
pub fn mesher_mut(&mut self) -> FetchMut<'_, Mesher>
Access a mutable mesher in the ECS world.
sourcepub fn create_base_entity(&mut self, id: &str, etype: &str) -> EntityBuilder<'_>
pub fn create_base_entity(&mut self, id: &str, etype: &str) -> EntityBuilder<'_>
Create a basic entity ready to be added more.
sourcepub fn create_entity(&mut self, id: &str, etype: &str) -> EntityBuilder<'_>
pub fn create_entity(&mut self, id: &str, etype: &str) -> EntityBuilder<'_>
Create a basic entity ready to be added more.
sourcepub fn create_block_entity(
&mut self,
id: &str,
etype: &str
) -> EntityBuilder<'_>
pub fn create_block_entity( &mut self, id: &str, etype: &str ) -> EntityBuilder<'_>
Create a basic entity ready to be added more.
sourcepub fn spawn_entity_at(
&mut self,
etype: &str,
position: &Vec3<f32>
) -> Option<Entity>
pub fn spawn_entity_at( &mut self, etype: &str, position: &Vec3<f32> ) -> Option<Entity>
Spawn an entity of type at a location.
pub fn revive_entity( &mut self, id: &str, etype: &str, metadata: MetadataComp ) -> Option<Entity>
pub fn populate_entity( &mut self, ent: Entity, id: &str, etype: &str, metadata: MetadataComp )
Auto Trait Implementations§
impl Freeze for World
impl !RefUnwindSafe for World
impl !Send for World
impl !Sync for World
impl Unpin for World
impl !UnwindSafe for World
Blanket Implementations§
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§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>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§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>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§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.source§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.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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 moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.