From 102f6d3338bc7027f7ec64fb3518083662ac0540 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Sat, 5 Jun 2021 17:30:20 +0300 Subject: [PATCH] EntityInfo assetization * Rename skillset_config to skillset_preset * Rename loadout_config to loadout_preset * Add skillset_config for asset_specifier of skillset * Add loadout_config for asset_specifier of loadout --- common/src/generation.rs | 22 ++++++++++++++++++---- common/src/states/basic_summon.rs | 9 +++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/common/src/generation.rs b/common/src/generation.rs index e922f604c7..e91763659a 100644 --- a/common/src/generation.rs +++ b/common/src/generation.rs @@ -25,8 +25,10 @@ pub struct EntityInfo { // TODO: Properly give NPCs skills pub level: Option, pub loot_drop: Option, - pub loadout_config: Option, - pub skillset_config: Option, + pub loadout_config: Option, + pub loadout_preset: Option, + pub skillset_config: Option, + pub skillset_preset: Option, pub pet: Option>, // we can't use DHashMap, do we want to move that into common? pub trading_information: Option, @@ -49,7 +51,9 @@ impl EntityInfo { level: None, loot_drop: None, loadout_config: None, + loadout_preset: None, skillset_config: None, + skillset_preset: None, pet: None, trading_information: None, } @@ -117,16 +121,26 @@ impl EntityInfo { self } - pub fn with_loadout_config(mut self, config: LoadoutConfig) -> Self { + pub fn with_loadout_config(mut self, config: String) -> Self { self.loadout_config = Some(config); self } - pub fn with_skillset_config(mut self, config: SkillSetConfig) -> Self { + pub fn with_loadout_preset(mut self, preset: LoadoutConfig) -> Self { + self.loadout_preset = Some(preset); + self + } + + pub fn with_skillset_config(mut self, config: String) -> Self { self.skillset_config = Some(config); self } + pub fn with_skillset_preset(mut self, preset: SkillSetConfig) -> Self { + self.skillset_preset = Some(preset); + self + } + pub fn with_automatic_name(mut self) -> Self { let npc_names = NPC_NAMES.read(); self.name = match &self.body { diff --git a/common/src/states/basic_summon.rs b/common/src/states/basic_summon.rs index 4abd7f8d8e..857ab191ed 100644 --- a/common/src/states/basic_summon.rs +++ b/common/src/states/basic_summon.rs @@ -79,14 +79,14 @@ impl CharacterBehavior for Data { let loadout = LoadoutBuilder::build_loadout( body, None, - self.static_data.summon_info.loadout_config, + self.static_data.summon_info.loadout_preset, None, ) .build(); let stats = comp::Stats::new("Summon".to_string()); let skill_set = SkillSetBuilder::build_skillset( &None, - self.static_data.summon_info.skillset_config, + self.static_data.summon_info.skillset_preset, ) .build(); @@ -175,6 +175,7 @@ pub struct SummonInfo { body: comp::Body, scale: Option, health_scaling: u16, - loadout_config: Option, - skillset_config: Option, + // TODO: use assets for specifying skills and loadouts? + loadout_preset: Option, + skillset_preset: Option, }