Responding to review

- make `skillset_builder::Preset` void enum and left comment about how to
extend it
- add `.with_default_equipment()` in case if preset is missing to `basic_summon`
loadout creation to match old `build_loadout()` behaviour
This commit is contained in:
juliancoffee 2021-06-14 13:55:25 +03:00
parent 057aa7fecf
commit d5cbe27612
2 changed files with 7 additions and 10 deletions

View File

@ -6,10 +6,11 @@ use crate::assets::{self, AssetExt};
use serde::{Deserialize, Serialize};
use tracing::warn;
/// `SkillSetBuilder` preset. Consider using loading from assets, when possible.
/// When you're adding new enum variant,
/// handle it in [`with_preset`](SkillSetBuilder::with_preset) method
#[derive(Copy, Clone, PartialEq, Serialize, Deserialize, Debug)]
pub enum Preset {
Empty,
}
pub enum Preset {}
#[derive(Debug, Deserialize, Clone)]
struct SkillSetTree(Vec<SkillNode>);
@ -89,12 +90,7 @@ impl SkillSetBuilder {
/// Applies preset
#[must_use]
pub const fn with_preset(self, preset: Preset) -> Self {
match preset {
Preset::Empty => {},
}
self
}
pub const fn with_preset(self, _preset: Preset) -> Self { self }
#[must_use]
/// # Panics

View File

@ -84,10 +84,11 @@ impl CharacterBehavior for Data {
let loadout = {
let loadout_builder =
LoadoutBuilder::new().with_default_maintool(&body);
// If preset is none, use default equipment
if let Some(preset) = loadout_config {
loadout_builder.with_preset(preset).build()
} else {
loadout_builder.build()
loadout_builder.with_default_equipment(&body).build()
}
};