mirror of
				https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
				synced 2024-08-15 00:43:27 +00:00 
			
		
		
		
	v2.0.3
- Fixed a bug that was causing alien addons to not render when pawns were wearing apparel
This commit is contained in:
		
							parent
							
								
									9144029fec
								
							
						
					
					
						commit
						001121649b
					
				
					 11 changed files with 20 additions and 13 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -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
 | 
					Change log v 2.0.2
 | 
				
			||||||
- Implemented texture caching to reduce the performance hit induced by dynamically cropping apparel
 | 
					- Implemented texture caching to reduce the performance hit induced by dynamically cropping apparel
 | 
				
			||||||
- Dynamically cropping apparel is now compatible with Sized Apparel
 | 
					- Dynamically cropping apparel is now compatible with Sized Apparel
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
				
			||||||
<Manifest>
 | 
					<Manifest>
 | 
				
			||||||
	<version>2.0.2</version>
 | 
						<version>2.0.3</version>
 | 
				
			||||||
    <downloadUri>https://gitgud.io/AbstractConcept/rimworld-animations-patch</downloadUri>
 | 
					    <downloadUri>https://gitgud.io/AbstractConcept/rimworld-animations-patch</downloadUri>
 | 
				
			||||||
</Manifest>
 | 
					</Manifest>
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -138,8 +138,8 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void UpdateVisibility()
 | 
					        public void UpdateVisibility()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (pawn == null || bodyAddon == null || bodyPartRecord == null) return;
 | 
					 | 
				
			||||||
            canDraw = true;
 | 
					            canDraw = true;
 | 
				
			||||||
 | 
					            if (pawn == null || bodyAddon == null || bodyPartRecord == null) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (pawn.health?.hediffSet?.GetNotMissingParts()?.Contains(bodyPartRecord) == false)
 | 
					            if (pawn.health?.hediffSet?.GetNotMissingParts()?.Contains(bodyPartRecord) == false)
 | 
				
			||||||
            { bodyPartMissing = true; return; }
 | 
					            { bodyPartMissing = true; return; }
 | 
				
			||||||
| 
						 | 
					@ -151,6 +151,7 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                CompApparelVisibility comp = apparel?.TryGetComp<CompApparelVisibility>();
 | 
					                CompApparelVisibility comp = apparel?.TryGetComp<CompApparelVisibility>();
 | 
				
			||||||
                if (comp == null) continue;
 | 
					                if (comp == null) continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                LoadRimNudeData(comp);
 | 
					                LoadRimNudeData(comp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (comp.isBeingWorn == false) continue;
 | 
					                if (comp.isBeingWorn == false) continue;
 | 
				
			||||||
| 
						 | 
					@ -158,7 +159,7 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
                if (bodyAddon.bodyPart == PatchBodyPartDefOf.Genitals ||
 | 
					                if (bodyAddon.bodyPart == PatchBodyPartDefOf.Genitals ||
 | 
				
			||||||
                    bodyAddon.bodyPart == PatchBodyPartDefOf.Anus ||
 | 
					                    bodyAddon.bodyPart == PatchBodyPartDefOf.Anus ||
 | 
				
			||||||
                    bodyAddon.bodyPart == PatchBodyPartDefOf.Chest ||
 | 
					                    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)
 | 
					                    if ((bodyAddon.bodyPart == PatchBodyPartDefOf.Genitals || bodyAddon.bodyPart == PatchBodyPartDefOf.Anus) && comp.coversGroin)
 | 
				
			||||||
                    { canDraw = false; return; };
 | 
					                    { canDraw = false; return; };
 | 
				
			||||||
| 
						 | 
					@ -166,16 +167,19 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
                    if (bodyAddon.bodyPart == PatchBodyPartDefOf.Chest && comp.coversChest)
 | 
					                    if (bodyAddon.bodyPart == PatchBodyPartDefOf.Chest && comp.coversChest)
 | 
				
			||||||
                    { canDraw = false; return; };
 | 
					                    { 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; }
 | 
					                    { canDraw = false; return; }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                else if (apparel.def.apparel.hatRenderedFrontOfFace || apparel.def.apparel.hatRenderedAboveBody || apparel.def.apparel.hatRenderedBehindHead)
 | 
				
			||||||
 | 
					                { return; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                else
 | 
					                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; };
 | 
					                    { 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; };
 | 
					                    { canDraw = false; return; };
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,8 +22,8 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageIdPlayerFacing == "babies.and.children.continued.13"))
 | 
										if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageIdPlayerFacing == "babies.and.children.continued.13"))
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						(new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "ShouldNotDrawAddonsForPawn"),
 | 
											(new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "ShouldNotAnimatePawn"),
 | 
				
			||||||
							prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_ShouldNotDrawAddonsForPawn")));
 | 
												prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_ShouldNotAnimatePawn")));
 | 
				
			||||||
						(new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "GetBodySize"),
 | 
											(new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "GetBodySize"),
 | 
				
			||||||
							prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_GetBodySize")));
 | 
												prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_GetBodySize")));
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
			catch (TypeLoadException) {  }
 | 
								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);			
 | 
								__result = AgeStages.IsYoungerThan(pawn, AgeStages.Child, false);			
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -121,7 +121,7 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
			{ ApparelAnimationUtility.TryToDrawApparelOnFloor(pawn); }
 | 
								{ ApparelAnimationUtility.TryToDrawApparelOnFloor(pawn); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Exit clauses
 | 
								// Exit clauses
 | 
				
			||||||
			if (BasicSettings.useLegacyAnimationSystem || AnimationPatchUtility.ShouldNotDrawAddonsForPawn(pawn) || sexDataComp == null)
 | 
								if (BasicSettings.useLegacyAnimationSystem || AnimationPatchUtility.ShouldNotAnimatePawn(pawn) || sexDataComp == null)
 | 
				
			||||||
			{ return true; }
 | 
								{ return true; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Get available hands
 | 
								// Get available hands
 | 
				
			||||||
| 
						 | 
					@ -141,7 +141,7 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
				if (bodyAddonDatum == null) continue;
 | 
									if (bodyAddonDatum == null) continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// Can draw?
 | 
									// 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;
 | 
									bool drawHand = BasicSettings.showHands && handsAvailableCount > 0 && renderFlags.FlagSet(PawnRenderFlags.Portrait) == false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (canDraw == false && drawHand == false)
 | 
									if (canDraw == false && drawHand == false)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -173,9 +173,9 @@ namespace Rimworld_Animations_Patch
 | 
				
			||||||
			return anchor;
 | 
								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)
 | 
							public static float GetBodySize(Pawn pawn)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue