diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll index dd3d63c..9135a27 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/Cowgirl/AnimationPropDef_Cowgirl_Xray.xml b/1.5/Defs/AnimationDefs/Cowgirl/AnimationPropDef_Cowgirl_Xray.xml index d7d4895..d41bde0 100644 --- a/1.5/Defs/AnimationDefs/Cowgirl/AnimationPropDef_Cowgirl_Xray.xml +++ b/1.5/Defs/AnimationDefs/Cowgirl/AnimationPropDef_Cowgirl_Xray.xml @@ -19,6 +19,10 @@ Head 95 TexPathVariants_Cowgirl_Xray + + + + diff --git a/1.5/Source/Animations/AnimationWorkers/AnimationWorker_KeyframesExtended.cs b/1.5/Source/Animations/AnimationWorkers/AnimationWorker_KeyframesExtended.cs index 3894b1a..395a16f 100644 --- a/1.5/Source/Animations/AnimationWorkers/AnimationWorker_KeyframesExtended.cs +++ b/1.5/Source/Animations/AnimationWorkers/AnimationWorker_KeyframesExtended.cs @@ -15,6 +15,11 @@ namespace Rimworld_Animations { } + public override bool Enabled() + { + return true; + } + public override Vector3 OffsetAtTick(int tick, PawnDrawParms parms) { //Todo: Use this for bodyoffsets diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs new file mode 100644 index 0000000..a013ea7 --- /dev/null +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs @@ -0,0 +1,32 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace Rimworld_Animations +{ + + [HarmonyPatch(typeof(PawnRenderer), "BodyAngle")] + + public class HarmonyPatch_PawnRenderer + { + public static bool Prefix(ref Pawn ___pawn, ref float __result) + { + //stop using cache when animating, for when downed (downed disables cache) + if (___pawn?.Drawer?.renderer?.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended) + { + __result = 0; + return false; + + } + + return true; + + } + } + + +} diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs index bd2213f..1b74ba1 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeProperties_GraphicVariants.cs @@ -10,6 +10,7 @@ namespace Rimworld_Animations public class PawnRenderNodeProperties_GraphicVariants : PawnRenderNodeProperties { + public AnimationOffsetDef propOffsetDef = null; public TexPathVariantsDef texPathVariantsDef = null; 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 1192bb0..4a8b195 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs @@ -61,9 +61,51 @@ namespace Rimworld_Animations return material; - } + public override Vector3 OffsetFor(PawnRenderNode node, PawnDrawParms parms, out Vector3 pivot) + { + Vector3 regularOffsets = base.OffsetFor(node, parms, out pivot); + if ((node.Props as PawnRenderNodeProperties_GraphicVariants)?.propOffsetDef?.offsets is List offsets) + { + foreach (BaseAnimationOffset offset in offsets) + { + if (offset.appliesToPawn(node.tree.pawn)) + { + //modify offset of prop for animationOffset position + regularOffsets += offset.getOffset(node.tree.pawn) ?? Vector3.zero; + return regularOffsets; + + } + } + } + + //unmodified; no offsets found + return regularOffsets; + } + + public override Quaternion RotationFor(PawnRenderNode node, PawnDrawParms parms) + { + Quaternion rotation = base.RotationFor(node, parms); + + if ((node.Props as PawnRenderNodeProperties_GraphicVariants)?.propOffsetDef?.offsets is List offsets) + { + foreach (BaseAnimationOffset offset in offsets) + { + if (offset.appliesToPawn(node.tree.pawn)) + { + //modify offset of prop for animationOffset rotation + rotation *= Quaternion.AngleAxis(offset.getRotation(node.tree.pawn) ?? 0, Vector3.up); + return rotation; + + } + } + } + + //unmodified; no rotation offsets found + return rotation; + + } } } diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs index 3dd665c..7b625b4 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs @@ -41,7 +41,7 @@ namespace Rimworld_Animations return GenerateVariants(pawn, props.texPathVariantsDef); - } + } protected override void EnsureMaterialsInitialized() { diff --git a/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_HideWhenAnimating.cs b/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_HideWhenAnimating.cs new file mode 100644 index 0000000..2656a1e --- /dev/null +++ b/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_HideWhenAnimating.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Verse; + +namespace Rimworld_Animations +{ + public class PawnRenderSubWorker_HideWhenAnimating : PawnRenderSubWorker + { + + public override void EditMaterial(PawnRenderNode node, PawnDrawParms parms, ref Material material) + { + if (node.tree.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended + || node.tree.rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended)) + { + material.color = Color.clear; + } + } + + } + +} diff --git a/LoadFolders.xml b/LoadFolders.xml index 8364c97..153b40d 100644 --- a/LoadFolders.xml +++ b/LoadFolders.xml @@ -29,6 +29,7 @@
  • 1.5
  • Patch_HumanoidAlienRaces/1.5
  • Patch_SexToysMasturbation/1.5
  • +
  • Patch_FacialAnimation/1.5
  • diff --git a/Patch_FacialAnimation/1.5/Patches/AnimationPatch_HideHeadWhenAnimating.xml b/Patch_FacialAnimation/1.5/Patches/AnimationPatch_HideHeadWhenAnimating.xml new file mode 100644 index 0000000..b8c72df --- /dev/null +++ b/Patch_FacialAnimation/1.5/Patches/AnimationPatch_HideHeadWhenAnimating.xml @@ -0,0 +1,27 @@ + + + + + Always + +
  • + /Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"]/subworkerClasses + Always + + /Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"] + + + + +
  • + +
  • + /Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"]/subworkerClasses + +
  • Rimworld_Animations.PawnRenderSubWorker_HideWhenAnimating
  • + + +
    +
    + +
    \ No newline at end of file diff --git a/Patch_HumanoidAlienRaces/1.5/Assemblies/Patch_HumanoidAlienRaces.dll b/Patch_HumanoidAlienRaces/1.5/Assemblies/Patch_HumanoidAlienRaces.dll index dc15131..7656a26 100644 Binary files a/Patch_HumanoidAlienRaces/1.5/Assemblies/Patch_HumanoidAlienRaces.dll and b/Patch_HumanoidAlienRaces/1.5/Assemblies/Patch_HumanoidAlienRaces.dll differ diff --git a/Patch_SexToysMasturbation/1.5/Assemblies/Patch_SexToysMasturbation.dll b/Patch_SexToysMasturbation/1.5/Assemblies/Patch_SexToysMasturbation.dll index abfae70..18ddee3 100644 Binary files a/Patch_SexToysMasturbation/1.5/Assemblies/Patch_SexToysMasturbation.dll and b/Patch_SexToysMasturbation/1.5/Assemblies/Patch_SexToysMasturbation.dll differ diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index 294fcea..8120d61 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -104,6 +104,7 @@ + @@ -133,6 +134,7 @@ + @@ -319,6 +321,7 @@ +