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
This commit is contained in:
juliancoffee 2021-06-05 17:30:20 +03:00
parent e832fa86f1
commit 102f6d3338
2 changed files with 23 additions and 8 deletions

View File

@ -25,8 +25,10 @@ pub struct EntityInfo {
// TODO: Properly give NPCs skills // TODO: Properly give NPCs skills
pub level: Option<u16>, pub level: Option<u16>,
pub loot_drop: Option<Item>, pub loot_drop: Option<Item>,
pub loadout_config: Option<LoadoutConfig>, pub loadout_config: Option<String>,
pub skillset_config: Option<SkillSetConfig>, pub loadout_preset: Option<LoadoutConfig>,
pub skillset_config: Option<String>,
pub skillset_preset: Option<SkillSetConfig>,
pub pet: Option<Box<EntityInfo>>, pub pet: Option<Box<EntityInfo>>,
// we can't use DHashMap, do we want to move that into common? // we can't use DHashMap, do we want to move that into common?
pub trading_information: Option<crate::trade::SiteInformation>, pub trading_information: Option<crate::trade::SiteInformation>,
@ -49,7 +51,9 @@ impl EntityInfo {
level: None, level: None,
loot_drop: None, loot_drop: None,
loadout_config: None, loadout_config: None,
loadout_preset: None,
skillset_config: None, skillset_config: None,
skillset_preset: None,
pet: None, pet: None,
trading_information: None, trading_information: None,
} }
@ -117,16 +121,26 @@ impl EntityInfo {
self 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.loadout_config = Some(config);
self 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.skillset_config = Some(config);
self 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 { pub fn with_automatic_name(mut self) -> Self {
let npc_names = NPC_NAMES.read(); let npc_names = NPC_NAMES.read();
self.name = match &self.body { self.name = match &self.body {

View File

@ -79,14 +79,14 @@ impl CharacterBehavior for Data {
let loadout = LoadoutBuilder::build_loadout( let loadout = LoadoutBuilder::build_loadout(
body, body,
None, None,
self.static_data.summon_info.loadout_config, self.static_data.summon_info.loadout_preset,
None, None,
) )
.build(); .build();
let stats = comp::Stats::new("Summon".to_string()); let stats = comp::Stats::new("Summon".to_string());
let skill_set = SkillSetBuilder::build_skillset( let skill_set = SkillSetBuilder::build_skillset(
&None, &None,
self.static_data.summon_info.skillset_config, self.static_data.summon_info.skillset_preset,
) )
.build(); .build();
@ -175,6 +175,7 @@ pub struct SummonInfo {
body: comp::Body, body: comp::Body,
scale: Option<comp::Scale>, scale: Option<comp::Scale>,
health_scaling: u16, health_scaling: u16,
loadout_config: Option<LoadoutConfig>, // TODO: use assets for specifying skills and loadouts?
skillset_config: Option<SkillSetConfig>, loadout_preset: Option<LoadoutConfig>,
skillset_preset: Option<SkillSetConfig>,
} }