mirror of
				https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
				synced 2024-08-15 00:43:45 +00:00 
			
		
		
		
	added hediff-based graphic variants
This commit is contained in:
		
							parent
							
								
									32f3b1522f
								
							
						
					
					
						commit
						67ff59ed80
					
				
					 20 changed files with 301 additions and 67 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -100,7 +100,7 @@
 | 
				
			||||||
			</li>
 | 
								</li>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			<li>
 | 
								<li>
 | 
				
			||||||
				<key>RenderNodeTag_Banana</key>
 | 
									<key>RenderNodeTag_Xray_Inside</key>
 | 
				
			||||||
				<value>
 | 
									<value>
 | 
				
			||||||
					<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
 | 
										<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
 | 
				
			||||||
					<keyframes>
 | 
										<keyframes>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,52 +0,0 @@
 | 
				
			||||||
<?xml version="1.0" encoding="utf-8" ?>
 | 
					 | 
				
			||||||
<Defs>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<PawnRenderNodeTagDef>
 | 
					 | 
				
			||||||
		<defName>RenderNodeTag_Banana</defName>
 | 
					 | 
				
			||||||
	</PawnRenderNodeTagDef>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<Rimworld_Animations.AnimationPropDef>
 | 
					 | 
				
			||||||
		<defName>AnimationProp_Banana</defName>
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		<!-- Note: props always return graphic_multi; set cardinal textures to blank and only north in anim if only one tex-->
 | 
					 | 
				
			||||||
		<!-- or draw east, south, and west directions, use them in animations? -->
 | 
					 | 
				
			||||||
		<animPropProperties Class="Rimworld_Animations.PawnRenderNodeProperties_GraphicVariants">
 | 
					 | 
				
			||||||
			<debugLabel>AnimProp_Banana</debugLabel>
 | 
					 | 
				
			||||||
			<nodeClass>Rimworld_Animations.PawnRenderNode_GraphicVariants</nodeClass>
 | 
					 | 
				
			||||||
			<workerClass>Rimworld_Animations.PawnRenderNodeWorker_GraphicVariants</workerClass>
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			<tagDef>RenderNodeTag_Banana</tagDef>
 | 
					 | 
				
			||||||
			<parentTagDef>Body</parentTagDef>
 | 
					 | 
				
			||||||
			<texPath>AnimationProps/Banana/Banana</texPath>
 | 
					 | 
				
			||||||
			<!-- for height -->
 | 
					 | 
				
			||||||
			<overlayLayer>Head</overlayLayer>
 | 
					 | 
				
			||||||
			<baseLayer>95</baseLayer>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			<texPathVariants>
 | 
					 | 
				
			||||||
				<li>AnimationProps/Cat/Cat1</li>
 | 
					 | 
				
			||||||
				<li>AnimationProps/Cat/Cat2</li>
 | 
					 | 
				
			||||||
			</texPathVariants>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			<absolutePosition>True</absolutePosition>
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		</animPropProperties>
 | 
					 | 
				
			||||||
	</Rimworld_Animations.AnimationPropDef>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<PawnRenderNodeTagDef>
 | 
					 | 
				
			||||||
		<defName>RenderNodeTag_Genitals</defName>
 | 
					 | 
				
			||||||
	</PawnRenderNodeTagDef>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<Rimworld_Animations.AnimationPropDef>
 | 
					 | 
				
			||||||
		<defName>AnimationProp_Genitals</defName>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		<animPropProperties>
 | 
					 | 
				
			||||||
			<debugLabel>AnimProp_Genitals</debugLabel>
 | 
					 | 
				
			||||||
			<useGraphic>false</useGraphic>
 | 
					 | 
				
			||||||
			<tagDef>RenderNodeTag_Genitals</tagDef>
 | 
					 | 
				
			||||||
			<parentTagDef>Body</parentTagDef>
 | 
					 | 
				
			||||||
			<!-- for height -->
 | 
					 | 
				
			||||||
			<overlayLayer>Head</overlayLayer>
 | 
					 | 
				
			||||||
			<baseLayer>95</baseLayer>
 | 
					 | 
				
			||||||
		</animPropProperties>
 | 
					 | 
				
			||||||
	</Rimworld_Animations.AnimationPropDef>
 | 
					 | 
				
			||||||
</Defs>
 | 
					 | 
				
			||||||
							
								
								
									
										18
									
								
								1.5/Defs/AnimationPropDefs/AnimationPropDef_Banana.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								1.5/Defs/AnimationPropDefs/AnimationPropDef_Banana.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,18 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
						<PawnRenderNodeTagDef>
 | 
				
			||||||
 | 
							<defName>RenderNodeTag_Banana</defName>
 | 
				
			||||||
 | 
						</PawnRenderNodeTagDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						<Rimworld_Animations.AnimationPropDef>
 | 
				
			||||||
 | 
							<defName>AnimationProp_Banana</defName>
 | 
				
			||||||
 | 
							<animPropProperties>
 | 
				
			||||||
 | 
								<debugLabel>Banana</debugLabel>
 | 
				
			||||||
 | 
								<tagDef>RenderNodeTag_Banana</tagDef>
 | 
				
			||||||
 | 
								<parentTagDef>Body</parentTagDef>
 | 
				
			||||||
 | 
								<texPath>AnimationProps/Banana/Banana</texPath>
 | 
				
			||||||
 | 
								<overlayLayer>Head</overlayLayer>
 | 
				
			||||||
 | 
								<baseLayer>95</baseLayer>
 | 
				
			||||||
 | 
							</animPropProperties>
 | 
				
			||||||
 | 
						</Rimworld_Animations.AnimationPropDef>
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
							
								
								
									
										24
									
								
								1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Inside.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Inside.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,24 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						<PawnRenderNodeTagDef>
 | 
				
			||||||
 | 
							<defName>RenderNodeTag_Xray_Inside</defName>
 | 
				
			||||||
 | 
						</PawnRenderNodeTagDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						<Rimworld_Animations.AnimationPropDef>
 | 
				
			||||||
 | 
							<defName>AnimationProp_Xray_Inside</defName>
 | 
				
			||||||
 | 
							<animPropProperties Class="Rimworld_Animations.PawnRenderNodeProperties_GraphicVariants">
 | 
				
			||||||
 | 
								<debugLabel>Xray Inside</debugLabel>
 | 
				
			||||||
 | 
								<nodeClass>Rimworld_Animations.PawnRenderNode_GraphicVariants</nodeClass>
 | 
				
			||||||
 | 
								<workerClass>Rimworld_Animations.PawnRenderNodeWorker_GraphicVariants</workerClass>
 | 
				
			||||||
 | 
								<tagDef>RenderNodeTag_Xray_Inside</tagDef>
 | 
				
			||||||
 | 
								<absoluteTransform>True</absoluteTransform>
 | 
				
			||||||
 | 
								<parentTagDef>Body</parentTagDef>
 | 
				
			||||||
 | 
								<!-- for height -->
 | 
				
			||||||
 | 
								<overlayLayer>Head</overlayLayer>
 | 
				
			||||||
 | 
								<baseLayer>95</baseLayer>
 | 
				
			||||||
 | 
								<texPathVariantsDef>TexPathVariants_Xray_Inside</texPathVariantsDef>
 | 
				
			||||||
 | 
							</animPropProperties>
 | 
				
			||||||
 | 
						</Rimworld_Animations.AnimationPropDef>
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
							
								
								
									
										35
									
								
								1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Penis.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Penis.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,35 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
						<PawnRenderNodeTagDef>
 | 
				
			||||||
 | 
							<defName>RenderNodeTag_Xray_Penis</defName>
 | 
				
			||||||
 | 
						</PawnRenderNodeTagDef>
 | 
				
			||||||
 | 
						<Rimworld_Animations.AnimationPropDef>
 | 
				
			||||||
 | 
							<defName>AnimationProp_Penis</defName>
 | 
				
			||||||
 | 
							<animPropProperties Class="Rimworld_Animations.PawnRenderNodeProperties_GraphicHediffVariants">
 | 
				
			||||||
 | 
								<debugLabel>Xray Penis</debugLabel>
 | 
				
			||||||
 | 
								<nodeClass>Rimworld_Animations.PawnRenderNode_GraphicHediffVariants</nodeClass>
 | 
				
			||||||
 | 
								<workerClass>Rimworld_Animations.PawnRenderNodeWorker_GraphicHediffVariants</workerClass>
 | 
				
			||||||
 | 
								<tagDef>RenderNodeTag_Xray_Penis</tagDef>
 | 
				
			||||||
 | 
								<parentTagDef>Body</parentTagDef>
 | 
				
			||||||
 | 
								<texPath>AnimationProps/Banana/Banana</texPath>
 | 
				
			||||||
 | 
								<!-- for height -->
 | 
				
			||||||
 | 
								<overlayLayer>Head</overlayLayer>
 | 
				
			||||||
 | 
								<baseLayer>95</baseLayer>
 | 
				
			||||||
 | 
								<absoluteTransform>True</absoluteTransform>
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								<!-- Default value if no hediff variant is found -->
 | 
				
			||||||
 | 
								<texPathVariantsDef>TexPathVariants_XrayPenis_Human</texPathVariantsDef>
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								<!-- select different hediff variants if applicable -->
 | 
				
			||||||
 | 
								<hediffVariants>
 | 
				
			||||||
 | 
									<li>
 | 
				
			||||||
 | 
										<hediffs>
 | 
				
			||||||
 | 
											<li>HorsePenis</li>
 | 
				
			||||||
 | 
											<li>RaccoonPenis</li>
 | 
				
			||||||
 | 
										</hediffs>
 | 
				
			||||||
 | 
										<texPathVariantsDef>TexPathVariants_XrayPenis_Horse</texPathVariantsDef>
 | 
				
			||||||
 | 
									</li>
 | 
				
			||||||
 | 
								</hediffVariants>
 | 
				
			||||||
 | 
							</animPropProperties>
 | 
				
			||||||
 | 
						</Rimworld_Animations.AnimationPropDef>
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
							
								
								
									
										11
									
								
								1.5/Defs/TexPathVariantsDefs/TexPathVariants_Cat.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								1.5/Defs/TexPathVariantsDefs/TexPathVariants_Cat.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
						<Rimworld_Animations.TexPathVariantsDef>
 | 
				
			||||||
 | 
							<defName>TexPathVariants_Cat</defName>
 | 
				
			||||||
 | 
							<variants>
 | 
				
			||||||
 | 
								<li>AnimationProps/Cat/Cat1</li><!-- variant 1 in animation -->
 | 
				
			||||||
 | 
								<li>AnimationProps/Cat/Cat2</li><!-- variant 2 in animation -->
 | 
				
			||||||
 | 
							</variants>
 | 
				
			||||||
 | 
						</Rimworld_Animations.TexPathVariantsDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
						<Rimworld_Animations.TexPathVariantsDef>
 | 
				
			||||||
 | 
							<defName>TexPathVariants_XrayPenis_Horse</defName>
 | 
				
			||||||
 | 
							<variants>
 | 
				
			||||||
 | 
								<li>AnimationProps/Cat/Cat1</li>
 | 
				
			||||||
 | 
								<!-- variant 1 in animation -->
 | 
				
			||||||
 | 
								<li>AnimationProps/Cat/Cat2</li>
 | 
				
			||||||
 | 
								<!-- variant 2 in animation -->
 | 
				
			||||||
 | 
							</variants>
 | 
				
			||||||
 | 
						</Rimworld_Animations.TexPathVariantsDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
						<Rimworld_Animations.TexPathVariantsDef>
 | 
				
			||||||
 | 
							<defName>TexPathVariants_XrayPenis_Human</defName>
 | 
				
			||||||
 | 
							<variants>
 | 
				
			||||||
 | 
								<li>AnimationProps/Cat/Cat1</li>
 | 
				
			||||||
 | 
								<!-- variant 1 in animation -->
 | 
				
			||||||
 | 
								<li>AnimationProps/Cat/Cat2</li>
 | 
				
			||||||
 | 
								<!-- variant 2 in animation -->
 | 
				
			||||||
 | 
							</variants>
 | 
				
			||||||
 | 
						</Rimworld_Animations.TexPathVariantsDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
							
								
								
									
										13
									
								
								1.5/Defs/TexPathVariantsDefs/TexPathVariants_Xray_Inside.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								1.5/Defs/TexPathVariantsDefs/TexPathVariants_Xray_Inside.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
						<Rimworld_Animations.TexPathVariantsDef>
 | 
				
			||||||
 | 
							<defName>TexPathVariants_Xray_Inside</defName>
 | 
				
			||||||
 | 
							<variants>
 | 
				
			||||||
 | 
								<li>AnimationProps/Cat/Cat1</li>
 | 
				
			||||||
 | 
								<!-- variant 1 in animation -->
 | 
				
			||||||
 | 
								<li>AnimationProps/Cat/Cat2</li>
 | 
				
			||||||
 | 
								<!-- variant 2 in animation -->
 | 
				
			||||||
 | 
							</variants>
 | 
				
			||||||
 | 
						</Rimworld_Animations.TexPathVariantsDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
| 
						 | 
					@ -153,6 +153,12 @@ namespace Rimworld_Animations {
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        PawnRenderNodeProperties props = animationProp.animPropProperties;
 | 
					                        PawnRenderNodeProperties props = animationProp.animPropProperties;
 | 
				
			||||||
 | 
					                        Log.Message("Texpath of prop:" + props.texPath);
 | 
				
			||||||
 | 
					                        if (props.texPath.NullOrEmpty())
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            Log.Message("Setting default texture");
 | 
				
			||||||
 | 
					                            props.texPath = "AnimationProps/Banana/Banana";
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        //create new render node
 | 
					                        //create new render node
 | 
				
			||||||
                        PawnRenderNode animRenderNode = (PawnRenderNode)Activator.CreateInstance(props.nodeClass, new object[] {
 | 
					                        PawnRenderNode animRenderNode = (PawnRenderNode)Activator.CreateInstance(props.nodeClass, new object[] {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,9 +38,19 @@ namespace Rimworld_Animations
 | 
				
			||||||
             * Set Render Node to absolute position
 | 
					             * Set Render Node to absolute position
 | 
				
			||||||
             */
 | 
					             */
 | 
				
			||||||
            if (node.Props is PawnRenderNodeProperties_GraphicVariants graphicVariantProp
 | 
					            if (node.Props is PawnRenderNodeProperties_GraphicVariants graphicVariantProp
 | 
				
			||||||
                && graphicVariantProp.absolutePosition)
 | 
					                && graphicVariantProp.absoluteTransform)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                matrix = parms.matrix;
 | 
					                matrix = parms.matrix;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //absolute transform -- just use the node's transform, not its ancestors
 | 
				
			||||||
 | 
					                node.GetTransform(parms, out Vector3 offset, out Vector3 pivot, out Quaternion quaternion, out Vector3 scale);
 | 
				
			||||||
 | 
					                 
 | 
				
			||||||
 | 
					                if (offset != Vector3.zero) matrix *= Matrix4x4.Translate(offset);
 | 
				
			||||||
 | 
					                if (pivot != Vector3.zero) matrix *= Matrix4x4.Translate(pivot);
 | 
				
			||||||
 | 
					                if (quaternion != Quaternion.identity) matrix *= Matrix4x4.Rotate(quaternion);
 | 
				
			||||||
 | 
					                if (scale != Vector3.one) matrix *= Matrix4x4.Scale(scale);
 | 
				
			||||||
 | 
					                if (pivot != Vector3.zero) matrix *= Matrix4x4.Translate(scale).inverse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                float num = node.Worker.AltitudeFor(node, parms);
 | 
					                float num = node.Worker.AltitudeFor(node, parms);
 | 
				
			||||||
                if (num != 0f)
 | 
					                if (num != 0f)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,26 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PawnRenderNodeProperties_GraphicHediffVariants : PawnRenderNodeProperties_GraphicVariants
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<TexPathVariants_Hediff> hediffVariants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public class TexPathVariants_Hediff
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<HediffDef> hediffs;
 | 
				
			||||||
 | 
					        public TexPathVariantsDef texPathVariantsDef;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PawnRenderNodeWorker_GraphicHediffVariants : PawnRenderNodeWorker_GraphicVariants
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        //same functionality as graphicvariants worker
 | 
				
			||||||
 | 
					        //just here for readability
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,67 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PawnRenderNode_GraphicHediffVariants : PawnRenderNode_GraphicVariants
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected new PawnRenderNodeProperties_GraphicHediffVariants props;
 | 
				
			||||||
 | 
					        private HediffDef curHediff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public PawnRenderNode_GraphicHediffVariants(Pawn pawn, PawnRenderNodeProperties props, PawnRenderTree tree) : base(pawn, props, tree)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            this.props = (PawnRenderNodeProperties_GraphicHediffVariants)props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected override Dictionary<int, Graphic> GraphicVariantsFor(Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //for each different hediff-based texpathvariants,
 | 
				
			||||||
 | 
					            foreach (TexPathVariants_Hediff texPathVariant_Hediff in props.hediffVariants)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //for all the hediffs corresponding to that texpathvariant,
 | 
				
			||||||
 | 
					                foreach (HediffDef hediffDef in texPathVariant_Hediff.hediffs)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //if the pawn has that hediff,
 | 
				
			||||||
 | 
					                    if (pawn.health.hediffSet.hediffs.Any((Hediff hediff) => hediff.def == hediffDef))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        //return that specific variant
 | 
				
			||||||
 | 
					                        curHediff = hediff.def;
 | 
				
			||||||
 | 
					                        return GenerateVariants(pawn, texPathVariant_Hediff.texPathVariantsDef);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //otherwise just use default
 | 
				
			||||||
 | 
					            curHediff = null;
 | 
				
			||||||
 | 
					            return base.GraphicVariantsFor(pawn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected override void EnsureMaterialsInitialized()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //if pawn no longer has the hediff,
 | 
				
			||||||
 | 
					            if (curHediff == null ||
 | 
				
			||||||
 | 
					                (this.tree.pawn.health?.hediffSet?.hediffs is List<Hediff> hediffs 
 | 
				
			||||||
 | 
					                && hediffs.Any((Hediff hediff) => hediff.def == curHediff)))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //redo graphicvariantsfor
 | 
				
			||||||
 | 
					                variants = GraphicVariantsFor(this.tree.pawn);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            base.EnsureMaterialsInitialized();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -10,8 +10,8 @@ namespace Rimworld_Animations
 | 
				
			||||||
    public class PawnRenderNodeProperties_GraphicVariants : PawnRenderNodeProperties
 | 
					    public class PawnRenderNodeProperties_GraphicVariants : PawnRenderNodeProperties
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public List<string> texPathVariants;
 | 
					        public TexPathVariantsDef texPathVariantsDef;
 | 
				
			||||||
        public bool absolutePosition = false;
 | 
					        public bool absoluteTransform = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,14 +30,14 @@ namespace Rimworld_Animations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //if node is animating, and is a graphic variant type of node
 | 
					            //if node is animating, and is a graphic variant type of node
 | 
				
			||||||
            if ((node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker)
 | 
					            if ((node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //and node is one with graphic variants
 | 
				
			||||||
                && (node is PawnRenderNode_GraphicVariants nodeWithGraphicVariants)
 | 
					                && (node is PawnRenderNode_GraphicVariants nodeWithGraphicVariants)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //and texpathvariant is set
 | 
				
			||||||
                && extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick) != null)
 | 
					                && extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick) != null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                //if node has a graphic variant,
 | 
					                return GetMaterialVariant(nodeWithGraphicVariants, parms, (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick));
 | 
				
			||||||
                int variant = (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                //return the variant
 | 
					 | 
				
			||||||
                return GetMaterialVariant(nodeWithGraphicVariants, parms, variant);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //otherwise return original texture
 | 
					            //otherwise return original texture
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,8 +11,8 @@ namespace Rimworld_Animations
 | 
				
			||||||
    public class PawnRenderNode_GraphicVariants : PawnRenderNode
 | 
					    public class PawnRenderNode_GraphicVariants : PawnRenderNode
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private new PawnRenderNodeProperties_GraphicVariants props;
 | 
					        protected new PawnRenderNodeProperties_GraphicVariants props;
 | 
				
			||||||
        private Dictionary<int, Graphic> variants;
 | 
					        protected Dictionary<int, Graphic> variants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public Graphic getGraphicVariant(int variant)
 | 
					        public Graphic getGraphicVariant(int variant)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -38,14 +38,22 @@ namespace Rimworld_Animations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected virtual Dictionary<int, Graphic> GraphicVariantsFor(Pawn pawn)
 | 
					        protected virtual Dictionary<int, Graphic> GraphicVariantsFor(Pawn pawn)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return GenerateVariants(pawn, props.texPathVariantsDef);
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected Dictionary<int, Graphic> GenerateVariants(Pawn pawn, TexPathVariantsDef texPathVariants)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Dictionary<int, Graphic> variantGraphics = new Dictionary<int, Graphic>();
 | 
					            Dictionary<int, Graphic> variantGraphics = new Dictionary<int, Graphic>();
 | 
				
			||||||
            Shader shader = this.ShaderFor(pawn);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //for each graphic variant
 | 
					            //for each graphic variant
 | 
				
			||||||
            for (int i = 0; i < props.texPathVariants.Count; i++)
 | 
					            for (int i = 0; i < texPathVariants.variants.Count; i++)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //get new graphic
 | 
					                //get new graphic
 | 
				
			||||||
                Graphic variant = GraphicDatabase.Get<Graphic_Multi>(props.texPathVariants[i], shader, Vector2.one, this.ColorFor(pawn));
 | 
					                Graphic variant = GraphicDatabase.Get<Graphic_Multi>(texPathVariants.variants[i], this.ShaderFor(pawn), Vector2.one, this.ColorFor(pawn));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //add it to the variants dictionary; i + 1 for easier readability in logs
 | 
					                //add it to the variants dictionary; i + 1 for easier readability in logs
 | 
				
			||||||
                variantGraphics.Add(i + 1, variant);
 | 
					                variantGraphics.Add(i + 1, variant);
 | 
				
			||||||
| 
						 | 
					@ -53,6 +61,7 @@ namespace Rimworld_Animations
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return variantGraphics;
 | 
					            return variantGraphics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								1.5/Source/PawnRenderNode/TexPathVariants.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								1.5/Source/PawnRenderNode/TexPathVariants.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class TexPathVariantsDef : Def
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<string> variants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -112,9 +112,13 @@
 | 
				
			||||||
    <Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
 | 
					    <Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\SexBaseReceivers\HarmonyPatch_JobDriver_SexBaseReceiverRaped.cs" />
 | 
					    <Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\SexBaseReceivers\HarmonyPatch_JobDriver_SexBaseReceiverRaped.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\SexBaseReceivers\HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs" />
 | 
					    <Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\SexBaseReceivers\HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\PawnRenderNode\GraphicHediffVariants\PawnRenderNodeProperties_GraphicHediffVariants.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\PawnRenderNode\GraphicHediffVariants\PawnRenderNodeWorker_GraphicHediffVariants.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\PawnRenderNode\GraphicHediffVariants\PawnRenderNode_GraphicHediffVariants.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\PawnRenderNode\GraphicVariants\PawnRenderNodeProperties_GraphicVariants.cs" />
 | 
					    <Compile Include="1.5\Source\PawnRenderNode\GraphicVariants\PawnRenderNodeProperties_GraphicVariants.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\PawnRenderNode\GraphicVariants\PawnRenderNodeWorker_GraphicVariants.cs" />
 | 
					    <Compile Include="1.5\Source\PawnRenderNode\GraphicVariants\PawnRenderNodeWorker_GraphicVariants.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\PawnRenderNode\GraphicVariants\PawnRenderNode_GraphicVariants.cs" />
 | 
					    <Compile Include="1.5\Source\PawnRenderNode\GraphicVariants\PawnRenderNode_GraphicVariants.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.5\Source\PawnRenderNode\TexPathVariants.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\RenderSubWorkers\PawnRenderSubWorker_ChangeOffset.cs" />
 | 
					    <Compile Include="1.5\Source\RenderSubWorkers\PawnRenderSubWorker_ChangeOffset.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Settings\AnimationSettings.cs" />
 | 
					    <Compile Include="1.5\Source\Settings\AnimationSettings.cs" />
 | 
				
			||||||
    <Compile Include="1.5\Source\Utilities\AnimationUtility.cs" />
 | 
					    <Compile Include="1.5\Source\Utilities\AnimationUtility.cs" />
 | 
				
			||||||
| 
						 | 
					@ -126,11 +130,17 @@
 | 
				
			||||||
    <Content Include="1.5\Assemblies\RJW.dll" />
 | 
					    <Content Include="1.5\Assemblies\RJW.dll" />
 | 
				
			||||||
    <Content Include="1.5\Defs\AnimationDefs\TestAnimation1.xml" />
 | 
					    <Content Include="1.5\Defs\AnimationDefs\TestAnimation1.xml" />
 | 
				
			||||||
    <Content Include="1.5\Defs\AnimationDefs\TestAnimation2.xml" />
 | 
					    <Content Include="1.5\Defs\AnimationDefs\TestAnimation2.xml" />
 | 
				
			||||||
    <Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef.xml" />
 | 
					    <Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef_Xray_Inside.xml" />
 | 
				
			||||||
 | 
					    <Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef_Banana.xml" />
 | 
				
			||||||
 | 
					    <Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef_Xray_Penis.xml" />
 | 
				
			||||||
    <Content Include="1.5\Defs\GroupAnimationDefs\TestGroupAnimation1.xml" />
 | 
					    <Content Include="1.5\Defs\GroupAnimationDefs\TestGroupAnimation1.xml" />
 | 
				
			||||||
    <Content Include="1.5\Defs\MainTabDefs\MainButtonDef.xml" />
 | 
					    <Content Include="1.5\Defs\MainTabDefs\MainButtonDef.xml" />
 | 
				
			||||||
    <Content Include="1.5\Defs\OffsetDefs\OffsetDef_GroinToAppropriateHeight.xml" />
 | 
					    <Content Include="1.5\Defs\OffsetDefs\OffsetDef_GroinToAppropriateHeight.xml" />
 | 
				
			||||||
    <Content Include="1.5\Defs\SoundDefs\Sounds_Sex.xml" />
 | 
					    <Content Include="1.5\Defs\SoundDefs\Sounds_Sex.xml" />
 | 
				
			||||||
 | 
					    <Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_Cat.xml" />
 | 
				
			||||||
 | 
					    <Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_Xray_Inside.xml" />
 | 
				
			||||||
 | 
					    <Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_XrayPenis_Horse.xml" />
 | 
				
			||||||
 | 
					    <Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_XrayPenis_Human.xml" />
 | 
				
			||||||
    <Content Include="1.5\Patches\AnimationPatchHSK.xml" />
 | 
					    <Content Include="1.5\Patches\AnimationPatchHSK.xml" />
 | 
				
			||||||
    <Content Include="1.5\Patches\AnimationPatch_CompExtendedAnimator.xml" />
 | 
					    <Content Include="1.5\Patches\AnimationPatch_CompExtendedAnimator.xml" />
 | 
				
			||||||
    <Content Include="1.5\Patches\AnimationPatch_PawnRenderTree_OffsetSubWorker.xml" />
 | 
					    <Content Include="1.5\Patches\AnimationPatch_PawnRenderTree_OffsetSubWorker.xml" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue