summaryrefslogtreecommitdiff
path: root/src/components/ear.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ear.rs')
-rw-r--r--src/components/ear.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/components/ear.rs b/src/components/ear.rs
new file mode 100644
index 0000000..d032122
--- /dev/null
+++ b/src/components/ear.rs
@@ -0,0 +1,24 @@
+
+use specs::{
+ HashMapStorage,
+ Component,
+};
+
+
+#[derive(Debug, Clone)]
+pub struct Sound {
+ pub source: Option<String>,
+ pub text: String
+}
+
+impl Sound {
+ pub fn as_message(self) -> (Option<String>, String) {
+ return (None, format!("{}: {}", self.source.unwrap_or("".to_string()), self.text));
+ }
+}
+
+#[derive(Component, Debug, Clone, Default)]
+#[storage(HashMapStorage)]
+pub struct Ear{
+ pub sounds: Vec<Sound>
+}