From 641ccd52822dbe9b379ce7c55b0f262a419b8a76 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Wed, 26 May 2021 19:40:50 +0200 Subject: [PATCH] Replace object initialization with read from file --- assets/common/loadouts/default.ron | 8 ++++++++ common/src/comp/inventory/loadout_builder.rs | 18 +----------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/assets/common/loadouts/default.ron b/assets/common/loadouts/default.ron index e69de29bb2..7138261464 100644 --- a/assets/common/loadouts/default.ron +++ b/assets/common/loadouts/default.ron @@ -0,0 +1,8 @@ +({ + Armor(Chest): Item("common.items.armor.misc.chest.worker_purple_brown"), + Armor(Legs): Item("common.items.armor.misc.pants.worker_brown"), + Armor(Feet): Item("common.items.armor.misc.foot.sandals"), + + Lantern: Item("common.items.lantern.black_0"), + Glider: Item("common.items.glider.glider_cloverleaf"), +}) \ No newline at end of file diff --git a/common/src/comp/inventory/loadout_builder.rs b/common/src/comp/inventory/loadout_builder.rs index 8769aa53af..6e26d994be 100644 --- a/common/src/comp/inventory/loadout_builder.rs +++ b/common/src/comp/inventory/loadout_builder.rs @@ -413,23 +413,7 @@ impl LoadoutBuilder { /// Set default armor items for the loadout. This may vary with game /// updates, but should be safe defaults for a new character. - pub fn defaults(self) -> Self { - self.chest(Some(Item::new_from_asset_expect( - "common.items.armor.misc.chest.worker_purple_brown", - ))) - .pants(Some(Item::new_from_asset_expect( - "common.items.armor.misc.pants.worker_brown", - ))) - .feet(Some(Item::new_from_asset_expect( - "common.items.armor.misc.foot.sandals", - ))) - .lantern(Some(Item::new_from_asset_expect( - "common.items.lantern.black_0", - ))) - .glider(Some(Item::new_from_asset_expect( - "common.items.glider.glider_cloverleaf", - ))) - } + pub fn defaults(self) -> Self { LoadoutBuilder::from_asset_expect("common.loadouts.default") } /// Builds loadout of creature when spawned #[allow(clippy::single_match)]