Fixed migration to properly insert components in the correct position. Fixed small error in how names were generated for any modular weapon that used the held component as its main component.

This commit is contained in:
Sam 2021-08-15 17:48:22 -04:00
parent a908eb5791
commit 01450b7e34
2 changed files with 822 additions and 815 deletions

View File

@ -274,13 +274,13 @@ pub(super) fn synthesize_modular_asset(specifier: &str) -> Option<RawItemDef> {
pub(super) fn modular_name<'a>(item: &'a Item, arg1: &'a str) -> Cow<'a, str> {
match item.kind() {
ItemKind::Tool(tool) => {
let damage_components = item.components().iter().filter(|comp| {
let main_components = item.components().iter().filter(|comp| {
matches!(comp.kind(), ItemKind::ModularComponent(ModularComponent { modkind, .. })
if matches!(modkind, ModularComponentKind::Damage)
if *modkind == ModularComponentKind::main_component(tool.kind)
)
});
// Last fine as there should only ever be one damage component on a weapon
let (material_name, weapon_name) = if let Some(component) = damage_components.last() {
let (material_name, weapon_name) = if let Some(component) = main_components.last() {
let materials =
component
.components()

File diff suppressed because it is too large Load Diff