blob: d03212241991cbf73810b8af3f94bfba08a25361 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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>
}
|