1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Provides utilities for stringly-typed data storage in bevy.
//!
//! # Features
//!
//! This crate includes:
//! + Key-value properties for entities and the world. See [`props`].
//! + Unique entity names and classes. See [`registry`].
//! + Arbitrary unidirectional links between entities. See [`links`].
//!
//! ```
//! # use bevy_ecs::prelude::*;
//! # use bevy_mod_props::prelude::*;
//! fn setup(mut commands: Commands) {
//! let mut gandalf = commands.spawn_empty()
//! .set_name("gandalf")
//! .set_class("wizard")
//! .set_prop("likes_elves", true)
//! .id();
//!
//! let mut bilbo = commands.spawn_empty()
//! .set_name("bilbo")
//! .set_class("hobbit")
//! .set_link("talking_to", gandalf)
//! .set_prop("has_ring", true)
//! .set_prop("wearing_ring", false)
//! .set_prop("health", 100.0)
//! .set_prop("wearing", "elven_cloak");
//! }
//!
//! fn system(world: &mut World) -> Result {
//! let bilbo = world.entity_mut_named("bilbo")?;
//! if bilbo.get_prop::<Estr>("wearing") == "elven_cloak" {
//! if let Some(entity_talked_to) = bilbo.follow_link("talking_to")
//! && entity_talked_to.get_prop("likes_elves")
//! {
//! // have the npc say something about bilbo's cloak here
//! }
//! }
//! Ok(())
//! }
//! ```