diff options
| author | troido <troido@protonmail.com> | 2021-12-31 14:38:26 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2021-12-31 14:38:26 +0100 |
| commit | 290eb2791b1da5836641df935c9bac5b21273e7b (patch) | |
| tree | 383e5aeaee5b0fe3b5f996f4e6298326247a03b9 /src/encyclopedia.rs | |
| parent | 755ae8512bfe3ff39a55c22a958e15399e886c5f (diff) | |
Diffstat (limited to 'src/encyclopedia.rs')
| -rw-r--r-- | src/encyclopedia.rs | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/encyclopedia.rs b/src/encyclopedia.rs index 76a7d28..b9df88a 100644 --- a/src/encyclopedia.rs +++ b/src/encyclopedia.rs @@ -12,9 +12,7 @@ use crate::{ item::Item, item::ItemAction, parameter::Parameter, - Sprite, - compmap, - componentwrapper::ComponentType + Sprite }; #[derive(Default, Clone)] @@ -61,15 +59,7 @@ impl<'de> Deserialize<'de> for Encyclopedia { let name = item.name.unwrap_or(id.clone()); let ent = item.entity.unwrap_or_else(||{ let enttyp = EntityType(id.clone()); - assemblages.insert(enttyp.clone(), Assemblage { - arguments: HashMap::new(), - save: true, - extract: Vec::new(), - components: vec![ - (ComponentType::Visible, compmap!{height: 0.3_f64, sprite: sprite.0, name: name.clone()}), - (ComponentType::Item, compmap!{item: id.clone()}) - ] - }); + assemblages.insert(enttyp.clone(), Assemblage::new_item(id.clone(), sprite, name.clone())); Template::from_entity_type(enttyp) }); itemdefs.insert(ItemId(id), Item{ @@ -79,10 +69,9 @@ impl<'de> Deserialize<'de> for Encyclopedia { }); } for (templatename, (baseent, args)) in templates { - let mut assemblage = assemblages.get(&baseent).ok_or(de::Error::custom(format!("template name '{:?}' does not point to not an assemblage", baseent)))?.clone(); - for (key, val) in args { - assemblage.arguments.insert(key, Some(val)); - } + let assemblage= assemblages.get(&baseent) + .ok_or(de::Error::custom(format!("template name '{:?}' does not point to not an assemblage", baseent)))? + .apply_arguments(args); assemblages.insert(templatename, assemblage); } |
