mirror of
				https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
				synced 2024-08-15 00:43:45 +00:00 
			
		
		
		
	various tweaks; portrait fix, pawntest whitelist/blacklist, more fixes for headfacing, granularity for render tree menu
This commit is contained in:
		
							parent
							
								
									bc283ec08e
								
							
						
					
					
						commit
						f30a02bcc8
					
				
					 22 changed files with 247 additions and 13 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -19,8 +19,8 @@
 | 
				
			||||||
			<overlayLayer>Head</overlayLayer>
 | 
								<overlayLayer>Head</overlayLayer>
 | 
				
			||||||
			<baseLayer>95</baseLayer>
 | 
								<baseLayer>95</baseLayer>
 | 
				
			||||||
			<texPathVariantsDef>TexPathVariants_Cowgirl_Xray</texPathVariantsDef>
 | 
								<texPathVariantsDef>TexPathVariants_Cowgirl_Xray</texPathVariantsDef>
 | 
				
			||||||
 | 
								
 | 
				
			||||||
			<!-- <propOffsetDef>PropOffsetDef_Cowgirl_Xray</propOffsetDef> -->
 | 
								<!-- <propOffsetDef>Offset_Cowgirl_Top</propOffsetDef> -->
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		</animPropProperties>
 | 
							</animPropProperties>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,6 +98,8 @@
 | 
				
			||||||
			</li>
 | 
								</li>
 | 
				
			||||||
			-->
 | 
								-->
 | 
				
			||||||
		</contexts>
 | 
							</contexts>
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		<offsetDefs>
 | 
							<offsetDefs>
 | 
				
			||||||
			<li>Offset_Placeholder</li> <!-- first pawn in animation -->
 | 
								<li>Offset_Placeholder</li> <!-- first pawn in animation -->
 | 
				
			||||||
			<li>Offset_Cowgirl_Top</li> <!-- second pawn in animation -->
 | 
								<li>Offset_Cowgirl_Top</li> <!-- second pawn in animation -->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,6 +71,11 @@
 | 
				
			||||||
		<contexts>
 | 
							<contexts>
 | 
				
			||||||
			<li Class="Rimworld_Animations.GroupAnimationContext_RJWSex">
 | 
								<li Class="Rimworld_Animations.GroupAnimationContext_RJWSex">
 | 
				
			||||||
				<priority>1</priority>
 | 
									<priority>1</priority>
 | 
				
			||||||
 | 
									<whitelist>
 | 
				
			||||||
 | 
										<li Class="Rimworld_Animations.PawnTest_RJWCanFuck" /> <!-- Corresponds to first pawn in list -->
 | 
				
			||||||
 | 
										<li Class="Rimworld_Animations.PawnTest_RJWCanFuck" /> <!-- Corresponds to second pawn in list -->
 | 
				
			||||||
 | 
										<li Class="Rimworld_Animations.PawnTest_RJWCanBeFucked" /> <!-- Corresponds to third pawn in list -->
 | 
				
			||||||
 | 
									</whitelist>
 | 
				
			||||||
				<actorShift>2</actorShift>
 | 
									<actorShift>2</actorShift>
 | 
				
			||||||
				<interactionDefs>
 | 
									<interactionDefs>
 | 
				
			||||||
					<li>Sex_DoublePenetration</li>
 | 
										<li>Sex_DoublePenetration</li>
 | 
				
			||||||
| 
						 | 
					@ -85,6 +90,11 @@
 | 
				
			||||||
			</li>
 | 
								</li>
 | 
				
			||||||
			<li Class="Rimworld_Animations.GroupAnimationContext_RJWSex">
 | 
								<li Class="Rimworld_Animations.GroupAnimationContext_RJWSex">
 | 
				
			||||||
				<priority>1</priority>
 | 
									<priority>1</priority>
 | 
				
			||||||
 | 
									<whitelist>
 | 
				
			||||||
 | 
										<li Class="Rimworld_Animations.PawnTest_RJWCanFuck" />
 | 
				
			||||||
 | 
										<li Class="Rimworld_Animations.PawnTest_RJWCanBeFucked" />
 | 
				
			||||||
 | 
										<li Class="Rimworld_Animations.PawnTest_RJWCanFuck" />
 | 
				
			||||||
 | 
									</whitelist>
 | 
				
			||||||
				<interactionDefs>
 | 
									<interactionDefs>
 | 
				
			||||||
					<li>Sex_Reverse_DoublePenetration</li>
 | 
										<li>Sex_Reverse_DoublePenetration</li>
 | 
				
			||||||
					<li>Sex_Reverse_DoublePenetrationM</li>
 | 
										<li>Sex_Reverse_DoublePenetrationM</li>
 | 
				
			||||||
| 
						 | 
					@ -115,6 +125,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	</Rimworld_Animations.GroupAnimationDef>
 | 
						</Rimworld_Animations.GroupAnimationDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						<!-- Branch stages below -->
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	<Rimworld_Animations.GroupAnimationDef>
 | 
						<Rimworld_Animations.GroupAnimationDef>
 | 
				
			||||||
		<defName>GroupAnimation_DP_Stage2_Branch1</defName>
 | 
							<defName>GroupAnimation_DP_Stage2_Branch1</defName>
 | 
				
			||||||
		<numActors>3</numActors>
 | 
							<numActors>3</numActors>
 | 
				
			||||||
| 
						 | 
					@ -143,7 +155,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	</Rimworld_Animations.GroupAnimationDef>
 | 
						</Rimworld_Animations.GroupAnimationDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	<Rimworld_Animations.GroupAnimationDef>
 | 
						<Rimworld_Animations.GroupAnimationDef>
 | 
				
			||||||
		<defName>GroupAnimation_DP_Stage2_Branch2</defName>
 | 
							<defName>GroupAnimation_DP_Stage2_Branch2</defName>
 | 
				
			||||||
		<numActors>3</numActors>
 | 
							<numActors>3</numActors>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,13 +11,46 @@ namespace Rimworld_Animations
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public int actorShift = 0;
 | 
					        public int actorShift = 0;
 | 
				
			||||||
        public int priority = 0;
 | 
					        public int priority = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<BasePawnTest> whitelist;
 | 
				
			||||||
 | 
					        public List<BasePawnTest> blacklist;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public virtual bool CanAnimationBeUsed(List<Pawn> actors, int numActors)
 | 
					        public virtual bool CanAnimationBeUsed(List<Pawn> actors, int numActors)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (numActors != actors.Count)
 | 
					            if (numActors != actors.Count)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (!whitelist.NullOrEmpty())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                for (int i = 0; i < whitelist.Count; i++)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    // check whitelist to make sure pawn can be in this act
 | 
				
			||||||
 | 
					                    //for each whitelist item, pawntest must hold true for that pawn
 | 
				
			||||||
 | 
					                    if (!whitelist[i].PawnTest(actors[i]))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        return false;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (!blacklist.NullOrEmpty())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                for (int i = 0; i < blacklist.Count; i++)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    // check blacklist to make sure pawn can be in this act
 | 
				
			||||||
 | 
					                    // for each blacklist item, pawntest must hold false for that pawn
 | 
				
			||||||
 | 
					                    if (blacklist[i].PawnTest(actors[i]))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        return false;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public virtual int AnimationReorder()
 | 
					        public virtual int AnimationReorder()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										15
									
								
								1.5/Source/Animations/PawnTests/BasePawnTest.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								1.5/Source/Animations/PawnTests/BasePawnTest.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public abstract class BasePawnTest
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public abstract bool PawnTest(Pawn pawn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										17
									
								
								1.5/Source/Animations/PawnTests/PawnTest_Always.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								1.5/Source/Animations/PawnTests/PawnTest_Always.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PawnTest_Always : BasePawnTest
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public override bool PawnTest(Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										27
									
								
								1.5/Source/Animations/PawnTests/PawnTest_Multi.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								1.5/Source/Animations/PawnTests/PawnTest_Multi.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,27 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PawnTest_Multi : BasePawnTest
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public List<BasePawnTest> tests = new List<BasePawnTest>();
 | 
				
			||||||
 | 
					        public override bool PawnTest(Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //check all different pawn tests in list for pawn
 | 
				
			||||||
 | 
					            foreach (BasePawnTest test in tests)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if (!test.PawnTest(pawn))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    return false;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										18
									
								
								1.5/Source/Animations/PawnTests/PawnTest_RJWCanBeFucked.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								1.5/Source/Animations/PawnTests/PawnTest_RJWCanBeFucked.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,18 @@
 | 
				
			||||||
 | 
					using rjw;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PawnTest_RJWCanBeFucked : BasePawnTest
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public override bool PawnTest(Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return xxx.can_be_fucked(pawn);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										18
									
								
								1.5/Source/Animations/PawnTests/PawnTest_RJWCanFuck.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								1.5/Source/Animations/PawnTests/PawnTest_RJWCanFuck.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,18 @@
 | 
				
			||||||
 | 
					using rjw;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PawnTest_RJWCanFuck : BasePawnTest
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public override bool PawnTest(Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return xxx.can_fuck(pawn);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -22,8 +22,8 @@ namespace Rimworld_Animations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override Vector3 getDrawPos()
 | 
					        public override Vector3 getDrawPos()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            //vector3.up means stand above the thing
 | 
					            //x and z position, regular altitude for pawns
 | 
				
			||||||
            return thing.DrawPos;
 | 
					            return new Vector3(thing.DrawPos.x, AltitudeLayer.Pawn.AltitudeFor(), thing.DrawPos.z);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void ExposeData()
 | 
					        public override void ExposeData()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,8 @@ namespace Rimworld_Animations
 | 
				
			||||||
        private Vector3 position;
 | 
					        private Vector3 position;
 | 
				
			||||||
        public ExtendedAnimatorAnchor_Vector3(Vector3 position) : base()
 | 
					        public ExtendedAnimatorAnchor_Vector3(Vector3 position) : base()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            this.position = position;
 | 
					            //default to altitude for layer for y
 | 
				
			||||||
 | 
					            this.position = new Vector3(position.x, AltitudeLayer.Pawn.AltitudeFor(), position.z);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override Vector3 getDrawPos()
 | 
					        public override Vector3 getDrawPos()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,9 +15,23 @@ namespace Rimworld_Animations
 | 
				
			||||||
        public static bool Prefix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target)
 | 
					        public static bool Prefix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
			//remove all bumping stuff in animations; keep draw nude code
 | 
								//remove all bumping stuff in animations; keep draw nude code
 | 
				
			||||||
 | 
								__instance.RotatePawns(pawn, __instance.Partner);
 | 
				
			||||||
			if (target != null)
 | 
								if (target != null)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				Pawn pawn2 = target as Pawn;
 | 
									Pawn pawn2 = target as Pawn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									if (pawn2 != null && !__instance.Sexprops.isRapist)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										// if not (pawn has root node and rootnode is animating)
 | 
				
			||||||
 | 
										if (!(pawn2?.Drawer?.renderer?.renderTree?.rootNode is PawnRenderNode rootNode
 | 
				
			||||||
 | 
										&& (rootNode.AnimationWorker is AnimationWorker_KeyframesExtended || rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended))))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
											//play bumpin anim
 | 
				
			||||||
 | 
											pawn.Drawer.Notify_MeleeAttackOn(target);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (!__instance.isEndytophile)
 | 
									if (!__instance.isEndytophile)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					SexUtility.DrawNude(pawn, false);
 | 
										SexUtility.DrawNude(pawn, false);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,6 +16,7 @@ namespace Rimworld_Animations {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //probably move this setting to a different mod menu if moving rjw parts of code
 | 
					        //probably move this setting to a different mod menu if moving rjw parts of code
 | 
				
			||||||
        public static bool playHumanlikeVoicesAsDefault = true;
 | 
					        public static bool playHumanlikeVoicesAsDefault = true;
 | 
				
			||||||
 | 
					        public static float floatRangeInRenderTreeMenu = 1f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static bool offsetTab = false, debugMode = false;
 | 
					        public static bool offsetTab = false, debugMode = false;
 | 
				
			||||||
        public static float shiverIntensity = 2f;
 | 
					        public static float shiverIntensity = 2f;
 | 
				
			||||||
| 
						 | 
					@ -34,6 +35,7 @@ namespace Rimworld_Animations {
 | 
				
			||||||
            Scribe_Values.Look(ref PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs");
 | 
					            Scribe_Values.Look(ref PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs");
 | 
				
			||||||
            Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true);
 | 
					            Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true);
 | 
				
			||||||
            Scribe_Values.Look(ref shiverIntensity, "RJWAnimations-shiverIntensity", 2f);
 | 
					            Scribe_Values.Look(ref shiverIntensity, "RJWAnimations-shiverIntensity", 2f);
 | 
				
			||||||
 | 
					            Scribe_Values.Look(ref floatRangeInRenderTreeMenu, "RJWAnimations-FloatRangeRenderMenu", 1f);
 | 
				
			||||||
            //todo: save offsetsByDefName
 | 
					            //todo: save offsetsByDefName
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -63,6 +65,9 @@ namespace Rimworld_Animations {
 | 
				
			||||||
            listingStandard.Label("RimAnim_ShiverIntensity".Translate() + RJWAnimationSettings.shiverIntensity);
 | 
					            listingStandard.Label("RimAnim_ShiverIntensity".Translate() + RJWAnimationSettings.shiverIntensity);
 | 
				
			||||||
            RJWAnimationSettings.shiverIntensity = listingStandard.Slider(RJWAnimationSettings.shiverIntensity, 0.0f, 12f);
 | 
					            RJWAnimationSettings.shiverIntensity = listingStandard.Slider(RJWAnimationSettings.shiverIntensity, 0.0f, 12f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            listingStandard.Label("RimAnim_FloatRangeRenderTree".Translate() + RJWAnimationSettings.floatRangeInRenderTreeMenu);
 | 
				
			||||||
 | 
					            RJWAnimationSettings.floatRangeInRenderTreeMenu = listingStandard.Slider(RJWAnimationSettings.floatRangeInRenderTreeMenu, 0.1f, 12f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            listingStandard.CheckboxLabeled("RimAnim_DebugMode".Translate(), ref RJWAnimationSettings.debugMode);
 | 
					            listingStandard.CheckboxLabeled("RimAnim_DebugMode".Translate(), ref RJWAnimationSettings.debugMode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
           
 | 
					           
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,47 @@
 | 
				
			||||||
 | 
					using HarmonyLib;
 | 
				
			||||||
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Reflection;
 | 
				
			||||||
 | 
					using System.Reflection.Emit;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    [HarmonyPatch(typeof(Dialog_DebugRenderTree), "RightRect")]
 | 
				
			||||||
 | 
					    public static class HarmonyPatch_Dialog_DebugRenderTree
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        static MethodInfo replaceFloatRangeMethod = SymbolExtensions.GetMethodInfo(() => HarmonyPatch_Dialog_DebugRenderTree.ReplaceFloatValueRange());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var codes = new List<CodeInstruction>(instructions);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for (int i = 0; i < codes.Count; i++)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //increase granularity of x and z sliders to be 0.01 instead
 | 
				
			||||||
 | 
					                if (codes[i].opcode == OpCodes.Ldc_R4 && (float)codes[i].operand == 0.05f)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    codes[i].operand = 0.001f;
 | 
				
			||||||
 | 
					                    codes[i - 8].opcode = OpCodes.Call;
 | 
				
			||||||
 | 
					                    codes[i - 8].operand = replaceFloatRangeMethod;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return codes.AsEnumerable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static FloatRange ReplaceFloatValueRange()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return new FloatRange(-RJWAnimationSettings.floatRangeInRenderTreeMenu, RJWAnimationSettings.floatRangeInRenderTreeMenu);
 | 
				
			||||||
 | 
					        }    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,8 @@ namespace Rimworld_Animations
 | 
				
			||||||
            if (__instance.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker)
 | 
					            if (__instance.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (parms.Portrait) return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // ADJUST FACING get rotated textures
 | 
					                // ADJUST FACING get rotated textures
 | 
				
			||||||
                // compare the previous tick to the current tick; if the current tick rotation is different, recache
 | 
					                // compare the previous tick to the current tick; if the current tick rotation is different, recache
 | 
				
			||||||
                parms.facing = extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick);
 | 
					                parms.facing = extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,10 @@ namespace Rimworld_Animations
 | 
				
			||||||
             * Facing offsets fix
 | 
					             * Facing offsets fix
 | 
				
			||||||
             */
 | 
					             */
 | 
				
			||||||
            //find lowest parent that is animating, or nothing if not animating
 | 
					            //find lowest parent that is animating, or nothing if not animating
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //don't do anything if portrait
 | 
				
			||||||
 | 
					            if (parms.Portrait) return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            PawnRenderNode animatingNode = node;
 | 
					            PawnRenderNode animatingNode = node;
 | 
				
			||||||
            while (animatingNode != null
 | 
					            while (animatingNode != null
 | 
				
			||||||
                && !(animatingNode.AnimationWorker is AnimationWorker_KeyframesExtended))
 | 
					                && !(animatingNode.AnimationWorker is AnimationWorker_KeyframesExtended))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ namespace Rimworld_Animations
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public static bool Prefix(ref Pawn ___pawn, ref float __result)
 | 
					        public static bool Prefix(ref Pawn ___pawn, ref float __result)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            //stop using cache when animating, for when downed (downed disables cache)
 | 
					            //set body angle to zero, for when downed
 | 
				
			||||||
            if (___pawn?.Drawer?.renderer?.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended)
 | 
					            if (___pawn?.Drawer?.renderer?.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                __result = 0;
 | 
					                __result = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,13 +12,21 @@ namespace Rimworld_Animations {
 | 
				
			||||||
        public static void Postfix(ref Pawn ___pawn, ref Vector3 __result) {
 | 
					        public static void Postfix(ref Pawn ___pawn, ref Vector3 __result) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //align pos on top of partner, position, etc., based on animatoranchor
 | 
					            //align pos on top of partner, position, etc., based on animatoranchor
 | 
				
			||||||
            if (___pawn.TryGetComp<CompExtendedAnimator>() is CompExtendedAnimator animator
 | 
					            if (___pawn.TryGetComp<CompExtendedAnimator>() is CompExtendedAnimator animator)
 | 
				
			||||||
                && animator.IsAnchored)
 | 
					 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Vector3 anchor = animator.getAnchor();
 | 
					                if (animator.IsAnchored)
 | 
				
			||||||
                //ignore y so that pawns don't clip through stuff
 | 
					                {
 | 
				
			||||||
                __result.x = anchor.x;
 | 
					                    Vector3 anchor = animator.getAnchor();
 | 
				
			||||||
                __result.z = anchor.z;
 | 
					                    __result.x = anchor.x;
 | 
				
			||||||
 | 
					                    __result.y = anchor.y;
 | 
				
			||||||
 | 
					                    __result.z = anchor.z;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    __result.y = AltitudeLayer.Pawn.AltitudeFor();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,8 @@ namespace Rimworld_Animations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void EditMaterial(PawnRenderNode node, PawnDrawParms parms, ref Material material)
 | 
					        public override void EditMaterial(PawnRenderNode node, PawnDrawParms parms, ref Material material)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            if (node.tree.pawn.def != ThingDefOf.Human) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (node.tree.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended
 | 
					            if (node.tree.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended
 | 
				
			||||||
                || node.tree.rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended))
 | 
					                || node.tree.rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -24,7 +26,10 @@ namespace Rimworld_Animations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void TransformLayer(PawnRenderNode node, PawnDrawParms parms, ref float layer)
 | 
					        public override void TransformLayer(PawnRenderNode node, PawnDrawParms parms, ref float layer)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            base.TransformLayer(node, parms, ref layer);
 | 
					            base.TransformLayer(node, parms, ref layer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (node.tree.pawn.def != ThingDefOf.Human) return;
 | 
				
			||||||
            layer -= 1000;
 | 
					            layer -= 1000;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@
 | 
				
			||||||
	<RimAnims_Warning>Warning--You generally don't want to change human offsets, only alien offsets or animals</RimAnims_Warning>
 | 
						<RimAnims_Warning>Warning--You generally don't want to change human offsets, only alien offsets or animals</RimAnims_Warning>
 | 
				
			||||||
	<RimAnims_CopyToClipboard>Copy Offset to Clipboard</RimAnims_CopyToClipboard>
 | 
						<RimAnims_CopyToClipboard>Copy Offset to Clipboard</RimAnims_CopyToClipboard>
 | 
				
			||||||
	<RimAnims_ShareSettings>Paste offset values in OffsetDef, or share in Discord</RimAnims_ShareSettings>
 | 
						<RimAnims_ShareSettings>Paste offset values in OffsetDef, or share in Discord</RimAnims_ShareSettings>
 | 
				
			||||||
 | 
						<RimAnim_FloatRangeRenderTree>Float range for Debug Render Tree offset menu</RimAnim_FloatRangeRenderTree>
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
</LanguageData>
 | 
					</LanguageData>
 | 
				
			||||||
| 
						 | 
					@ -84,6 +84,11 @@
 | 
				
			||||||
    <Compile Include="1.5\Source\Animations\AnimationOffsets\Offsets\BodyTypeOffset.cs" />
 | 
					    <Compile Include="1.5\Source\Animations\AnimationOffsets\Offsets\BodyTypeOffset.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Animations\AnimationProps\AnimationPropDef.cs" />
 | 
					    <Compile Include="1.5\Source\Animations\AnimationProps\AnimationPropDef.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Animations\AnimationWorkers\AnimationWorker_KeyframesExtended.cs" />
 | 
					    <Compile Include="1.5\Source\Animations\AnimationWorkers\AnimationWorker_KeyframesExtended.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\Animations\PawnTests\BasePawnTest.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\Animations\PawnTests\PawnTest_Always.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\Animations\PawnTests\PawnTest_Multi.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\Animations\PawnTests\PawnTest_RJWCanBeFucked.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\Animations\PawnTests\PawnTest_RJWCanFuck.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Comps\CompExtendedAnimator.cs" />
 | 
					    <Compile Include="1.5\Source\Comps\CompExtendedAnimator.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Comps\CompProperties_ExtendedAnimator.cs" />
 | 
					    <Compile Include="1.5\Source\Comps\CompProperties_ExtendedAnimator.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Comps\CompProperties_ThingAnimator.cs" />
 | 
					    <Compile Include="1.5\Source\Comps\CompProperties_ThingAnimator.cs" />
 | 
				
			||||||
| 
						 | 
					@ -104,6 +109,7 @@
 | 
				
			||||||
    <Compile Include="1.5\Source\MainTabWindows\OffsetMainButtonDefOf.cs" />
 | 
					    <Compile Include="1.5\Source\MainTabWindows\OffsetMainButtonDefOf.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\MainTabWindows\WorldComponent_UpdateMainTab.cs" />
 | 
					    <Compile Include="1.5\Source\MainTabWindows\WorldComponent_UpdateMainTab.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Patches\Harmony_PatchAll.cs" />
 | 
					    <Compile Include="1.5\Source\Patches\Harmony_PatchAll.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_Dialog_DebugRenderTree.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderer.cs" />
 | 
					    <Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderer.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderNode.cs" />
 | 
					    <Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderNode.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderNodeWorker.cs" />
 | 
					    <Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderNodeWorker.cs" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue