From 6a7a74e6878ff04e61e6ef21a922e314b9bab271 Mon Sep 17 00:00:00 2001 From: troido Date: Sun, 1 Mar 2020 22:28:02 +0100 Subject: use generics for message components --- src/componentwrapper.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/componentwrapper.rs') diff --git a/src/componentwrapper.rs b/src/componentwrapper.rs index 2fe114a..08164e4 100644 --- a/src/componentwrapper.rs +++ b/src/componentwrapper.rs @@ -7,8 +7,23 @@ use crate::{ RoomId, Sprite, playerstate::RoomPos, - attack::Attack, - components::{Visible, Movable, Blocking, Player, Floor, Item, Inventory, Health, Serialise, RoomExit, Trap, Fighter, Healing, Volatile}, + components::{ + Visible, + Movable, + Blocking, + Player, + Floor, + Item, + Inventory, + Health, + Serialise, + RoomExit, + Trap, + Fighter, + Healing, + Volatile, + AttackMessage + }, parameter::{Parameter, ParameterType} }; @@ -115,8 +130,8 @@ components!( } } }; - Trap (damage: Int) {Trap{attack: Attack::new(damage)}}; - Fighter (damage: Int, cooldown: Int) {Fighter{attack: Attack::new(damage), cooldown}}; + Trap (damage: Int) {Trap{attack: AttackMessage::new(damage)}}; + Fighter (damage: Int, cooldown: Int) {Fighter{attack: AttackMessage::new(damage), cooldown}}; Healing (delay: Int, health: Int) {Healing{delay, health, next_heal: None}}; Volatile (delay: Int) {Volatile{delay, end_time: None}}; ); -- cgit