From baff97472dc38494165e87bfe829e661f900ca57 Mon Sep 17 00:00:00 2001 From: yngtdd Date: Sun, 10 Apr 2022 12:52:14 -0400 Subject: [PATCH] refactor(data): Check to see if an item is a weapon This gives us the ability to load weapon entites from our data files. --- src/spawner/template.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/spawner/template.rs b/src/spawner/template.rs index 322ef9e..0b02e0d 100644 --- a/src/spawner/template.rs +++ b/src/spawner/template.rs @@ -106,6 +106,14 @@ impl Templates { } }); } + + if let Some(damage) = &template.base_damage { + commands.add_component(entity, Damage(*damage)); + + if template.entity_type == EntityType::Item { + commands.add_component(entity, Weapon{}); + } + } } }