pub struct Blueprint {
pub name: String,
pub description: String,
pub regions: BTreeMap<Region, Vec<Entity>>,
pub entities: BTreeMap<Entity, ComponentTypeTree>,
pub instances: BTreeMap<Region, BTreeMap<Entity, Vec<ComponentTree>>>,
}Expand description
Blueprint of a World
Represents a World in programmable data
Fields§
§name: StringWorld’s Name
description: StringWorld’s Description
regions: BTreeMap<Region, Vec<Entity>>Region names and Entities that exist in it
entities: BTreeMap<Entity, ComponentTypeTree>Entity name and Names of its Components
instances: BTreeMap<Region, BTreeMap<Entity, Vec<ComponentTree>>>Instances of different Entities in different Regions
Implementations§
Source§impl Blueprint
impl Blueprint
pub fn new(world_name: String, world_description: String) -> Self
Sourcepub fn preload(&mut self, regions: Vec<Region>, entities: Vec<Entity>)
pub fn preload(&mut self, regions: Vec<Region>, entities: Vec<Entity>)
Preloads Region and Entity Keys
The add_instance associated function will fail when preload is not called to preload the Region and Entity keys needed in the Instances table
pub fn add_entity(&mut self, name: Entity, component_types: ComponentTypeTree)
pub fn add_region(&mut self, name: Region, entities: Vec<Entity>)
pub fn add_instance( &mut self, region: Region, entity: Entity, component_tree: ComponentTree, ) -> Result<()>
Sourcepub fn add_default_instance(
&mut self,
region: Region,
entity: Entity,
) -> Result<u64>
pub fn add_default_instance( &mut self, region: Region, entity: Entity, ) -> Result<u64>
Add Instance with default values
Fetches the component tree structure from self.entities and creates an Instance with default values according to the Entity’s ComponentTypeTree
Sourcepub fn get_default_components(&self, entity: &Entity) -> Result<ComponentTree>
pub fn get_default_components(&self, entity: &Entity) -> Result<ComponentTree>
Return Instance with default values
Fetches the component tree structure from self.entities and creates an Instance with default values according to the Entity’s ComponentTypeTree
pub fn get_instance( &mut self, region: Region, entity: Entity, nonce: u64, ) -> Result<ComponentTree>
pub fn get_component_value( &mut self, region: Region, entity: Entity, nonce: u64, component: Component, ) -> Result<ComponentValue>
pub fn set_component_value( &mut self, region: Region, entity: Entity, nonce: u64, component: Component, value: ComponentValue, ) -> Result<()>
Trait Implementations§
impl Eq for Blueprint
impl StructuralPartialEq for Blueprint
Auto Trait Implementations§
impl Freeze for Blueprint
impl RefUnwindSafe for Blueprint
impl Send for Blueprint
impl Sync for Blueprint
impl Unpin for Blueprint
impl UnwindSafe for Blueprint
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
Mutably borrows from an owned value. Read more