diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll
index 1870329..7a6e149 100644
Binary files a/1.5/Assemblies/Rimworld-Animations.dll and b/1.5/Assemblies/Rimworld-Animations.dll differ
diff --git a/1.5/Defs/AnimationDefs/TestAnimation1.xml b/1.5/Defs/AnimationDefs/TestAnimation1.xml
index caee678..59f4cd2 100644
--- a/1.5/Defs/AnimationDefs/TestAnimation1.xml
+++ b/1.5/Defs/AnimationDefs/TestAnimation1.xml
@@ -100,7 +100,7 @@
- RenderNodeTag_Banana
+ RenderNodeTag_Xray_Inside
Rimworld_Animations.AnimationWorker_KeyframesExtended
diff --git a/1.5/Defs/AnimationPropDefs/AnimationPropDef.xml b/1.5/Defs/AnimationPropDefs/AnimationPropDef.xml
deleted file mode 100644
index 7815092..0000000
--- a/1.5/Defs/AnimationPropDefs/AnimationPropDef.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
- RenderNodeTag_Banana
-
-
-
- AnimationProp_Banana
-
-
-
-
- AnimProp_Banana
- Rimworld_Animations.PawnRenderNode_GraphicVariants
- Rimworld_Animations.PawnRenderNodeWorker_GraphicVariants
-
- RenderNodeTag_Banana
- Body
- AnimationProps/Banana/Banana
-
- Head
- 95
-
-
- AnimationProps/Cat/Cat1
- AnimationProps/Cat/Cat2
-
-
- True
-
-
-
-
-
- RenderNodeTag_Genitals
-
-
-
- AnimationProp_Genitals
-
-
- AnimProp_Genitals
- false
- RenderNodeTag_Genitals
- Body
-
- Head
- 95
-
-
-
diff --git a/1.5/Defs/AnimationPropDefs/AnimationPropDef_Banana.xml b/1.5/Defs/AnimationPropDefs/AnimationPropDef_Banana.xml
new file mode 100644
index 0000000..fc1e606
--- /dev/null
+++ b/1.5/Defs/AnimationPropDefs/AnimationPropDef_Banana.xml
@@ -0,0 +1,18 @@
+
+
+
+ RenderNodeTag_Banana
+
+
+
+ AnimationProp_Banana
+
+ Banana
+ RenderNodeTag_Banana
+ Body
+ AnimationProps/Banana/Banana
+ Head
+ 95
+
+
+
diff --git a/1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Inside.xml b/1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Inside.xml
new file mode 100644
index 0000000..c758775
--- /dev/null
+++ b/1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Inside.xml
@@ -0,0 +1,24 @@
+
+
+
+
+ RenderNodeTag_Xray_Inside
+
+
+
+ AnimationProp_Xray_Inside
+
+ Xray Inside
+ Rimworld_Animations.PawnRenderNode_GraphicVariants
+ Rimworld_Animations.PawnRenderNodeWorker_GraphicVariants
+ RenderNodeTag_Xray_Inside
+ True
+ Body
+
+ Head
+ 95
+ TexPathVariants_Xray_Inside
+
+
+
+
diff --git a/1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Penis.xml b/1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Penis.xml
new file mode 100644
index 0000000..e0a97c2
--- /dev/null
+++ b/1.5/Defs/AnimationPropDefs/AnimationPropDef_Xray_Penis.xml
@@ -0,0 +1,35 @@
+
+
+
+ RenderNodeTag_Xray_Penis
+
+
+ AnimationProp_Penis
+
+ Xray Penis
+ Rimworld_Animations.PawnRenderNode_GraphicHediffVariants
+ Rimworld_Animations.PawnRenderNodeWorker_GraphicHediffVariants
+ RenderNodeTag_Xray_Penis
+ Body
+ AnimationProps/Banana/Banana
+
+ Head
+ 95
+ True
+
+
+ TexPathVariants_XrayPenis_Human
+
+
+
+
+
+ HorsePenis
+ RaccoonPenis
+
+ TexPathVariants_XrayPenis_Horse
+
+
+
+
+
\ No newline at end of file
diff --git a/1.5/Defs/TexPathVariantsDefs/TexPathVariants_Cat.xml b/1.5/Defs/TexPathVariantsDefs/TexPathVariants_Cat.xml
new file mode 100644
index 0000000..474aca4
--- /dev/null
+++ b/1.5/Defs/TexPathVariantsDefs/TexPathVariants_Cat.xml
@@ -0,0 +1,11 @@
+
+
+
+ TexPathVariants_Cat
+
+ AnimationProps/Cat/Cat1
+ AnimationProps/Cat/Cat2
+
+
+
+
\ No newline at end of file
diff --git a/1.5/Defs/TexPathVariantsDefs/TexPathVariants_XrayPenis_Horse.xml b/1.5/Defs/TexPathVariantsDefs/TexPathVariants_XrayPenis_Horse.xml
new file mode 100644
index 0000000..3b14154
--- /dev/null
+++ b/1.5/Defs/TexPathVariantsDefs/TexPathVariants_XrayPenis_Horse.xml
@@ -0,0 +1,13 @@
+
+
+
+ TexPathVariants_XrayPenis_Horse
+
+ AnimationProps/Cat/Cat1
+
+ AnimationProps/Cat/Cat2
+
+
+
+
+
\ No newline at end of file
diff --git a/1.5/Defs/TexPathVariantsDefs/TexPathVariants_XrayPenis_Human.xml b/1.5/Defs/TexPathVariantsDefs/TexPathVariants_XrayPenis_Human.xml
new file mode 100644
index 0000000..235ee3e
--- /dev/null
+++ b/1.5/Defs/TexPathVariantsDefs/TexPathVariants_XrayPenis_Human.xml
@@ -0,0 +1,13 @@
+
+
+
+ TexPathVariants_XrayPenis_Human
+
+ AnimationProps/Cat/Cat1
+
+ AnimationProps/Cat/Cat2
+
+
+
+
+
\ No newline at end of file
diff --git a/1.5/Defs/TexPathVariantsDefs/TexPathVariants_Xray_Inside.xml b/1.5/Defs/TexPathVariantsDefs/TexPathVariants_Xray_Inside.xml
new file mode 100644
index 0000000..4c9f90b
--- /dev/null
+++ b/1.5/Defs/TexPathVariantsDefs/TexPathVariants_Xray_Inside.xml
@@ -0,0 +1,13 @@
+
+
+
+ TexPathVariants_Xray_Inside
+
+ AnimationProps/Cat/Cat1
+
+ AnimationProps/Cat/Cat2
+
+
+
+
+
\ No newline at end of file
diff --git a/1.5/Source/Comps/CompExtendedAnimator.cs b/1.5/Source/Comps/CompExtendedAnimator.cs
index a85a5fc..13cd1d3 100644
--- a/1.5/Source/Comps/CompExtendedAnimator.cs
+++ b/1.5/Source/Comps/CompExtendedAnimator.cs
@@ -153,6 +153,12 @@ namespace Rimworld_Animations {
{
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
PawnRenderNode animRenderNode = (PawnRenderNode)Activator.CreateInstance(props.nodeClass, new object[] {
diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs
index 621b881..b79853f 100644
--- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs
+++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs
@@ -38,9 +38,19 @@ namespace Rimworld_Animations
* Set Render Node to absolute position
*/
if (node.Props is PawnRenderNodeProperties_GraphicVariants graphicVariantProp
- && graphicVariantProp.absolutePosition)
+ && graphicVariantProp.absoluteTransform)
{
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);
if (num != 0f)
{
diff --git a/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNodeProperties_GraphicHediffVariants.cs b/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNodeProperties_GraphicHediffVariants.cs
new file mode 100644
index 0000000..894c085
--- /dev/null
+++ b/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNodeProperties_GraphicHediffVariants.cs
@@ -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 hediffVariants;
+
+ }
+
+ public class TexPathVariants_Hediff
+ {
+
+ public List hediffs;
+ public TexPathVariantsDef texPathVariantsDef;
+
+ }
+
+
+}
diff --git a/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNodeWorker_GraphicHediffVariants.cs b/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNodeWorker_GraphicHediffVariants.cs
new file mode 100644
index 0000000..24a10dc
--- /dev/null
+++ b/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNodeWorker_GraphicHediffVariants.cs
@@ -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
+
+ }
+}
diff --git a/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNode_GraphicHediffVariants.cs b/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNode_GraphicHediffVariants.cs
new file mode 100644
index 0000000..8d78dca
--- /dev/null
+++ b/1.5/Source/PawnRenderNode/GraphicHediffVariants/PawnRenderNode_GraphicHediffVariants.cs
@@ -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 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 hediffs
+ && hediffs.Any((Hediff hediff) => hediff.def == curHediff)))
+ {
+ //redo graphicvariantsfor
+ variants = GraphicVariantsFor(this.tree.pawn);
+ }
+
+ base.EnsureMaterialsInitialized();
+ }
+
+
+ }
+
+}
diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs
index b1a8720..15ac022 100644
--- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs
+++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs
@@ -10,8 +10,8 @@ namespace Rimworld_Animations
public class PawnRenderNodeProperties_GraphicVariants : PawnRenderNodeProperties
{
- public List texPathVariants;
- public bool absolutePosition = false;
+ public TexPathVariantsDef texPathVariantsDef;
+ public bool absoluteTransform = false;
}
}
diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs
index 15b5a92..50a8caa 100644
--- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs
+++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs
@@ -30,14 +30,14 @@ namespace Rimworld_Animations
//if node is animating, and is a graphic variant type of node
if ((node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker)
+
+ //and node is one with graphic variants
&& (node is PawnRenderNode_GraphicVariants nodeWithGraphicVariants)
+
+ //and texpathvariant is set
&& extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick) != null)
{
- //if node has a graphic variant,
- int variant = (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick);
-
- //return the variant
- return GetMaterialVariant(nodeWithGraphicVariants, parms, variant);
+ return GetMaterialVariant(nodeWithGraphicVariants, parms, (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick));
}
//otherwise return original texture
diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs
index fa46ce7..64eb815 100644
--- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs
+++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs
@@ -11,8 +11,8 @@ namespace Rimworld_Animations
public class PawnRenderNode_GraphicVariants : PawnRenderNode
{
- private new PawnRenderNodeProperties_GraphicVariants props;
- private Dictionary variants;
+ protected new PawnRenderNodeProperties_GraphicVariants props;
+ protected Dictionary variants;
public Graphic getGraphicVariant(int variant)
{
@@ -38,14 +38,22 @@ namespace Rimworld_Animations
protected virtual Dictionary GraphicVariantsFor(Pawn pawn)
{
+
+ return GenerateVariants(pawn, props.texPathVariantsDef);
+
+ }
+
+ protected Dictionary GenerateVariants(Pawn pawn, TexPathVariantsDef texPathVariants)
+ {
+
Dictionary variantGraphics = new Dictionary();
- Shader shader = this.ShaderFor(pawn);
//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
- Graphic variant = GraphicDatabase.Get(props.texPathVariants[i], shader, Vector2.one, this.ColorFor(pawn));
+ Graphic variant = GraphicDatabase.Get(texPathVariants.variants[i], this.ShaderFor(pawn), Vector2.one, this.ColorFor(pawn));
//add it to the variants dictionary; i + 1 for easier readability in logs
variantGraphics.Add(i + 1, variant);
@@ -53,6 +61,7 @@ namespace Rimworld_Animations
}
return variantGraphics;
+
}
diff --git a/1.5/Source/PawnRenderNode/TexPathVariants.cs b/1.5/Source/PawnRenderNode/TexPathVariants.cs
new file mode 100644
index 0000000..d741756
--- /dev/null
+++ b/1.5/Source/PawnRenderNode/TexPathVariants.cs
@@ -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 variants;
+
+ }
+}
diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj
index e676bbd..2ab9ff6 100644
--- a/Rimworld-Animations.csproj
+++ b/Rimworld-Animations.csproj
@@ -112,9 +112,13 @@
+
+
+
+
@@ -126,11 +130,17 @@
-
+
+
+
+
+
+
+