diff options
| author | troido <troido@protonmail.com> | 2021-12-30 21:20:46 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2021-12-30 21:20:46 +0100 |
| commit | 755ae8512bfe3ff39a55c22a958e15399e886c5f (patch) | |
| tree | 167b34f51071ee6ec915b787094c8dadef2d4dde /src/components | |
| parent | d10d3e0368bd1178085ab8abd2ea24afe912b26f (diff) | |
entities can now have descriptions
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/ear.rs | 11 | ||||
| -rw-r--r-- | src/components/mod.rs | 5 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/components/ear.rs b/src/components/ear.rs index 6b723b0..6e832aa 100644 --- a/src/components/ear.rs +++ b/src/components/ear.rs @@ -40,6 +40,10 @@ pub enum Notification { Options { description: String, options: Vec<(String, String)> + }, + Describe{ + name: String, + description: String } } @@ -59,7 +63,8 @@ impl Notification { }, Kill{actor: _, target: _} => "kill", Die{actor: _, target: _} => "die", - Options{description: _, options: _} => "options" + Options{description: _, options: _} => "options", + Describe{name: _, description: _} => "describe", }).to_string() } @@ -91,6 +96,10 @@ impl Notification { Options{description, options} => {( format!("{}. Options: {}", description, options.iter().map(|(command, desc)| format!("'{}': {};", command, desc)).collect::<Vec<String>>().join(" ")), json!({"description": description.clone(), "options": options.clone()}) + )}, + Describe{name, description} => {( + format!("{} - {}", name, description), + json!({"description": description.clone(), "name": name.clone()}) )} }; (self.type_name(), body, payload) diff --git a/src/components/mod.rs b/src/components/mod.rs index d462fef..4c2ccf4 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -264,3 +264,8 @@ pub struct Requirements { pub required_flags: HashSet<Flag>, pub blocking_flags: HashSet<Flag> } + +#[derive(Component, Debug, Clone)] +pub struct Description { + pub description: String +} |
