diff --git a/1.4/Assemblies/Rimworld-Animations-Patch.dll b/1.4/Assemblies/Rimworld-Animations-Patch.dll index 707716e..65d8d39 100644 Binary files a/1.4/Assemblies/Rimworld-Animations-Patch.dll and b/1.4/Assemblies/Rimworld-Animations-Patch.dll differ diff --git a/About/Changelog_v2.0.2.txt b/About/Changelog_v2.0.3.txt similarity index 75% rename from About/Changelog_v2.0.2.txt rename to About/Changelog_v2.0.3.txt index 758b24c..c9e0e0e 100644 --- a/About/Changelog_v2.0.2.txt +++ b/About/Changelog_v2.0.3.txt @@ -1,3 +1,6 @@ +Change log v 2.0.3 +- Fixed a bug that was causing alien addons to not render when pawns were wearing apparel + Change log v 2.0.2 - Implemented texture caching to reduce the performance hit induced by dynamically cropping apparel - Dynamically cropping apparel is now compatible with Sized Apparel diff --git a/About/Manifest.xml b/About/Manifest.xml index f800735..4d6bc19 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,5 +1,5 @@ - 2.0.2 + 2.0.3 https://gitgud.io/AbstractConcept/rimworld-animations-patch \ No newline at end of file diff --git a/Source/.vs/Rimworld-Animations-Patch/v16/.suo b/Source/.vs/Rimworld-Animations-Patch/v16/.suo index a60364e..de8941a 100644 Binary files a/Source/.vs/Rimworld-Animations-Patch/v16/.suo and b/Source/.vs/Rimworld-Animations-Patch/v16/.suo differ diff --git a/Source/Scripts/Defs/BodyAddonData.cs b/Source/Scripts/Defs/BodyAddonData.cs index a47692a..c21561f 100644 --- a/Source/Scripts/Defs/BodyAddonData.cs +++ b/Source/Scripts/Defs/BodyAddonData.cs @@ -138,8 +138,8 @@ namespace Rimworld_Animations_Patch public void UpdateVisibility() { - if (pawn == null || bodyAddon == null || bodyPartRecord == null) return; canDraw = true; + if (pawn == null || bodyAddon == null || bodyPartRecord == null) return; if (pawn.health?.hediffSet?.GetNotMissingParts()?.Contains(bodyPartRecord) == false) { bodyPartMissing = true; return; } @@ -151,6 +151,7 @@ namespace Rimworld_Animations_Patch { CompApparelVisibility comp = apparel?.TryGetComp(); if (comp == null) continue; + LoadRimNudeData(comp); if (comp.isBeingWorn == false) continue; @@ -158,7 +159,7 @@ namespace Rimworld_Animations_Patch if (bodyAddon.bodyPart == PatchBodyPartDefOf.Genitals || bodyAddon.bodyPart == PatchBodyPartDefOf.Anus || bodyAddon.bodyPart == PatchBodyPartDefOf.Chest || - bodyAddon.hediffGraphics?.Any(x => x.path.NullOrEmpty() == false && (x.path.Contains("belly") || x.path.Contains("Belly"))) == true) + bodyAddon.hediffGraphics?.Any(x => x.path.NullOrEmpty() == false && x.path.Contains("belly", StringComparison.OrdinalIgnoreCase)) == true) { if ((bodyAddon.bodyPart == PatchBodyPartDefOf.Genitals || bodyAddon.bodyPart == PatchBodyPartDefOf.Anus) && comp.coversGroin) { canDraw = false; return; }; @@ -166,16 +167,19 @@ namespace Rimworld_Animations_Patch if (bodyAddon.bodyPart == PatchBodyPartDefOf.Chest && comp.coversChest) { canDraw = false; return; }; - if (bodyAddon.hediffGraphics?.Any(x => x.path.NullOrEmpty() == false && (x.path.Contains("belly") || x.path.Contains("Belly"))) == true && comp.coversBelly) + if (bodyAddon.hediffGraphics?.Any(x => x.path.NullOrEmpty() == false && x.path.Contains("belly", StringComparison.OrdinalIgnoreCase)) == true && comp.coversBelly) { canDraw = false; return; } } + else if (apparel.def.apparel.hatRenderedFrontOfFace || apparel.def.apparel.hatRenderedAboveBody || apparel.def.apparel.hatRenderedBehindHead) + { return; } + else { - if (bodyAddon.hiddenUnderApparelFor?.Any(x => apparel?.def.apparel?.hatRenderedFrontOfFace == false && apparel.def.apparel?.bodyPartGroups?.Contains(x) == true) == true) + if (bodyAddon.hiddenUnderApparelFor?.Any(x => apparel.def.apparel.bodyPartGroups?.Contains(x) == true) == true) { canDraw = false; return; }; - if (bodyAddon.hiddenUnderApparelTag?.Any(x => apparel?.def.apparel?.hatRenderedFrontOfFace == false && apparel.def.apparel?.tags?.Contains(x) == true) == true) + if (bodyAddon.hiddenUnderApparelTag?.Any(x => apparel.def.apparel.tags?.Contains(x) == true) == true) { canDraw = false; return; }; } } diff --git a/Source/Scripts/Patches/HarmonyPatch_BabiesAndChildren.cs b/Source/Scripts/Patches/HarmonyPatch_BabiesAndChildren.cs index cf2cedb..164d43f 100644 --- a/Source/Scripts/Patches/HarmonyPatch_BabiesAndChildren.cs +++ b/Source/Scripts/Patches/HarmonyPatch_BabiesAndChildren.cs @@ -22,8 +22,8 @@ namespace Rimworld_Animations_Patch { if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageIdPlayerFacing == "babies.and.children.continued.13")) { - (new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "ShouldNotDrawAddonsForPawn"), - prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_ShouldNotDrawAddonsForPawn"))); + (new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "ShouldNotAnimatePawn"), + prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_ShouldNotAnimatePawn"))); (new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "GetBodySize"), prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_GetBodySize"))); } @@ -33,7 +33,7 @@ namespace Rimworld_Animations_Patch catch (TypeLoadException) { } } - public static bool Prefix_ShouldNotDrawAddonsForPawn(ref bool __result, Pawn pawn) + public static bool ShouldNotAnimatePawn(ref bool __result, Pawn pawn) { __result = AgeStages.IsYoungerThan(pawn, AgeStages.Child, false); diff --git a/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs b/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs index 13074ba..c10ff11 100644 --- a/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs +++ b/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs @@ -121,7 +121,7 @@ namespace Rimworld_Animations_Patch { ApparelAnimationUtility.TryToDrawApparelOnFloor(pawn); } // Exit clauses - if (BasicSettings.useLegacyAnimationSystem || AnimationPatchUtility.ShouldNotDrawAddonsForPawn(pawn) || sexDataComp == null) + if (BasicSettings.useLegacyAnimationSystem || AnimationPatchUtility.ShouldNotAnimatePawn(pawn) || sexDataComp == null) { return true; } // Get available hands @@ -141,7 +141,7 @@ namespace Rimworld_Animations_Patch if (bodyAddonDatum == null) continue; // Can draw? - bool canDraw = addonGraphic.path.Contains("featureless") == false && addonGraphic.path.Contains("Featureless") == false && bodyAddonDatum.CanDraw(); + bool canDraw = addonGraphic.path.Contains("featureless", StringComparison.OrdinalIgnoreCase) == false && bodyAddonDatum.CanDraw(); bool drawHand = BasicSettings.showHands && handsAvailableCount > 0 && renderFlags.FlagSet(PawnRenderFlags.Portrait) == false; if (canDraw == false && drawHand == false) diff --git a/Source/Scripts/Utilities/AnimationPatchUtility.cs b/Source/Scripts/Utilities/AnimationPatchUtility.cs index cea6963..ded7091 100644 --- a/Source/Scripts/Utilities/AnimationPatchUtility.cs +++ b/Source/Scripts/Utilities/AnimationPatchUtility.cs @@ -173,9 +173,9 @@ namespace Rimworld_Animations_Patch return anchor; } - public static bool ShouldNotDrawAddonsForPawn(Pawn pawn) + public static bool ShouldNotAnimatePawn(Pawn pawn) { - return false; + return pawn.ageTracker.CurLifeStage.developmentalStage == DevelopmentalStage.Baby || pawn.ageTracker.CurLifeStage.developmentalStage == DevelopmentalStage.Child; } public static float GetBodySize(Pawn pawn) diff --git a/Source/obj/Debug/Rimworld-Animations-Patch.csprojAssemblyReference.cache b/Source/obj/Debug/Rimworld-Animations-Patch.csprojAssemblyReference.cache index 0039789..cf3e4eb 100644 Binary files a/Source/obj/Debug/Rimworld-Animations-Patch.csprojAssemblyReference.cache and b/Source/obj/Debug/Rimworld-Animations-Patch.csprojAssemblyReference.cache differ diff --git a/Source/obj/Debug/Rimworld-Animations-Patch.dll b/Source/obj/Debug/Rimworld-Animations-Patch.dll index 707716e..65d8d39 100644 Binary files a/Source/obj/Debug/Rimworld-Animations-Patch.dll and b/Source/obj/Debug/Rimworld-Animations-Patch.dll differ diff --git a/Source/obj/Debug/Rimworld-Animations-Patch.pdb b/Source/obj/Debug/Rimworld-Animations-Patch.pdb index e68da75..aa1d26a 100644 Binary files a/Source/obj/Debug/Rimworld-Animations-Patch.pdb and b/Source/obj/Debug/Rimworld-Animations-Patch.pdb differ