diff options
Diffstat (limited to 'src/components/mod.rs')
| -rw-r--r-- | src/components/mod.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/components/mod.rs b/src/components/mod.rs index 330bc67..7ca0eba 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -123,16 +123,17 @@ pub struct Attacked { pub attacks: Vec<Attack> } -pub fn add_attack(attacked: &mut WriteStorage<Attacked> , ent: Entity, attack: Attack) { - attacked - .entry(ent) - .unwrap() - .or_insert_with(Attacked::default) - .attacks - .push(attack); +impl Attacked { + pub fn add_attack(attacked: &mut WriteStorage<Attacked> , ent: Entity, attack: Attack) { + attacked + .entry(ent) + .unwrap() + .or_insert_with(Attacked::default) + .attacks + .push(attack); + } } - #[derive(Default, Component, Debug, Clone)] #[storage(NullStorage)] pub struct Entered; @@ -153,3 +154,11 @@ pub struct Fighter { pub attack: Attack } +#[derive(Component, Debug, Clone)] +#[storage(HashMapStorage)] +pub struct Healing { + pub delay: i64, + pub health: i64, + pub next_heal: Option<i64> +} + |
