diff --git a/Schemas/MorphDef.xsd b/Schemas/MorphDef.xsd index 8d8030495..3f6880cb9 100644 --- a/Schemas/MorphDef.xsd +++ b/Schemas/MorphDef.xsd @@ -136,27 +136,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -273,7 +252,6 @@ - diff --git a/Source/Dependencies/AlienRace.dll b/Source/Dependencies/AlienRace.dll index b92bfbcc5..9bc7a1177 100644 Binary files a/Source/Dependencies/AlienRace.dll and b/Source/Dependencies/AlienRace.dll differ diff --git a/Source/Pawnmorphs/Esoteria/Hybrids/HybridRaceSettings.cs b/Source/Pawnmorphs/Esoteria/Hybrids/HybridRaceSettings.cs index 9be0e40d4..c98b8d22c 100644 --- a/Source/Pawnmorphs/Esoteria/Hybrids/HybridRaceSettings.cs +++ b/Source/Pawnmorphs/Esoteria/Hybrids/HybridRaceSettings.cs @@ -37,8 +37,6 @@ public class HybridRaceSettings public RaceRestrictionSettings restrictionSettings; /// The graphics settings public GraphicsSettings graphicsSettings; - /// The trait settings - public TraitSettings traitSettings; /// /// The explicit hybrid race @@ -252,21 +250,6 @@ public class FoodSettings public List foodOverrides = new List(); } - //should this be deprecated? - /// - /// obsolete - /// - [Obsolete] - public class TraitSettings - { - /// - /// - /// - //should this be deprecated? - public List> forcedTraits; - //public List disallowedTraits; removing traits not supported right now, rimworld doesn't like it when you remove them - } - /// /// generate AlienRace thought settings with the given morph def /// diff --git a/Source/Pawnmorphs/Esoteria/Hybrids/RaceGenerator.cs b/Source/Pawnmorphs/Esoteria/Hybrids/RaceGenerator.cs index 3b7c3edac..66542a745 100644 --- a/Source/Pawnmorphs/Esoteria/Hybrids/RaceGenerator.cs +++ b/Source/Pawnmorphs/Esoteria/Hybrids/RaceGenerator.cs @@ -294,13 +294,10 @@ private static void CreateImplicitMeshes(ThingDef_AlienRace race) /// private static GeneralSettings GenerateHybridGeneralSettings(GeneralSettings human, MorphDef morph, ThingDef_AlienRace impliedRace) { - var traitSettings = morph.raceSettings.traitSettings; return new GeneralSettings { alienPartGenerator = GenerateHybridGenerator(human.alienPartGenerator, morph, impliedRace), - humanRecipeImport = true, - forcedRaceTraitEntries = traitSettings?.forcedTraits - // Black list is not currently supported, Rimworld doesn't like it when you remove traits. + humanRecipeImport = true }; } @@ -310,10 +307,8 @@ private static AlienPartGenerator GenerateHybridGenerator(AlienPartGenerator hum { bodyTypes = human.bodyTypes.MakeSafe().ToList(), headTypes = human.headTypes.MakeSafe().ToList(), - offsetDefaults = human.offsetDefaults.MakeSafe().ToList(), headOffset = human.headOffset, headOffsetSpecific = human.headOffsetSpecific, - headOffsetDirectional = human.headOffsetDirectional, bodyAddons = GenerateBodyAddons(human.bodyAddons, morph), colorChannels = human.colorChannels, alienProps = impliedRace @@ -497,7 +492,7 @@ private static ThingDef_AlienRace.AlienSettings GenerateHybridAlienSettings(Thin GeneralSettings generalSettings = GenerateHybridGeneralSettings(human.generalSettings, morph, impliedRace); return new ThingDef_AlienRace.AlienSettings { - generalSettings = GenerateHybridGeneralSettings(human.generalSettings, morph, impliedRace), + generalSettings = generalSettings, graphicPaths = GenerateGraphicPaths(human.graphicPaths, morph, generalSettings), styleSettings = human.styleSettings, raceRestriction = GenerateHybridRestrictionSettings(human.raceRestriction, morph), @@ -652,7 +647,14 @@ public static void DoHarStuff() { foreach (ThingDef_AlienRace race in _raceLookupTable.Keys) { - DoHarStuff(race); + try + { + DoHarStuff(race); + } + catch (Exception e) + { + Log.Error($"[Pawnmorpher] Failed to properly add {race.defName} to HAR.\n" + e); + } } } @@ -743,7 +745,6 @@ private static void DoHarStuff(ThingDef_AlienRace ar) } ThingCategoryDefOf.CorpsesHumanlike.ResolveReferences(); } - ar.alienRace.generalSettings.alienPartGenerator.GenerateMeshsAndMeshPools(); if (ar.alienRace.generalSettings.humanRecipeImport && ar != ThingDefOf.Human) { (ar.recipes ?? (ar.recipes = new List())).AddRange(ThingDefOf.Human.recipes.Where((RecipeDef rd) => !rd.targetsBodyPart || rd.appliedOnFixedBodyParts.NullOrEmpty() || rd.appliedOnFixedBodyParts.Any((BodyPartDef bpd) => ar.race.body.AllParts.Any((BodyPartRecord bpr) => bpr.def == bpd)))); diff --git a/Source/Pawnmorphs/Esoteria/Hybrids/RaceShiftUtilities.cs b/Source/Pawnmorphs/Esoteria/Hybrids/RaceShiftUtilities.cs index 47487dba4..45189e797 100644 --- a/Source/Pawnmorphs/Esoteria/Hybrids/RaceShiftUtilities.cs +++ b/Source/Pawnmorphs/Esoteria/Hybrids/RaceShiftUtilities.cs @@ -678,10 +678,10 @@ static void ReRollRaceTraits(Pawn pawn, ThingDef_AlienRace newRace) var traitsToAdd = allAlienTraits; - foreach (AlienChanceEntry alienTraitEntry in traitsToAdd) + foreach (AlienChanceEntry alienTraitEntry in traitsToAdd) { - var def = alienTraitEntry.defName; - if (traitSet.HasTrait(def)) continue; //don't add traits that are already added + var trait = alienTraitEntry.defName; + if (traitSet.HasTrait(trait.def)) continue; //don't add traits that are already added var add = (Rand.RangeInclusive(0, 100) <= alienTraitEntry.chance); @@ -697,9 +697,9 @@ static void ReRollRaceTraits(Pawn pawn, ThingDef_AlienRace newRace) if (add) { - var degree = def.DataAtDegree(alienTraitEntry.degree); + var degree = trait.def.DataAtDegree(trait.degree); - traitSet.GainTrait(new Trait(def, alienTraitEntry.degree, true)); + traitSet.GainTrait(new Trait(trait.def, trait.degree, true)); if (degree.skillGains != null) UpdateSkillsPostAdd(pawn, degree.skillGains); //need to update the skills manually } diff --git a/Source/Pawnmorphs/Esoteria/PawnmorpherModInit.cs b/Source/Pawnmorphs/Esoteria/PawnmorpherModInit.cs index 4a26a5a43..9e79293cb 100644 --- a/Source/Pawnmorphs/Esoteria/PawnmorpherModInit.cs +++ b/Source/Pawnmorphs/Esoteria/PawnmorpherModInit.cs @@ -496,10 +496,8 @@ private static void CheckDefaultOffsets([NotNull] ThingDef_AlienRace aRace, [Not foreach (AlienPartGenerator.OffsetNamed hDefaultOffset in hSettings.offsetDefaults) { - if (aSettings.offsetDefaults.All(a => a.name != hDefaultOffset.name)) - { + if (aSettings.offsetDefaults.Any(a => a.name != hDefaultOffset.name)) aSettings.offsetDefaults.Add(hDefaultOffset); - } } }