diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll index 1870329..9ecd083 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..466bbb4 100644 --- a/1.5/Defs/AnimationDefs/TestAnimation1.xml +++ b/1.5/Defs/AnimationDefs/TestAnimation1.xml @@ -98,9 +98,8 @@ -
  • - 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/GroupAnimationDefs/TestGroupAnimation1.xml b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml index 6be826f..1f68f3d 100644 --- a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml +++ b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml @@ -3,6 +3,7 @@ TestGroupAnimation1 2 + True
  • 10 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/Animations/GroupAnimations/GroupAnimationDef.cs b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs index 55f3bea..c9cc5e0 100644 --- a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs +++ b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs @@ -55,6 +55,7 @@ namespace Rimworld_Animations { //element at or default to stop errors if (offsetDefs == null) return null; + if ((actor + reorder) % numActors >= offsetDefs.Count) return null; return offsetDefs[(actor + reorder) % numActors].FindOffset(pawn); } } diff --git a/1.5/Source/Comps/CompExtendedAnimator.cs b/1.5/Source/Comps/CompExtendedAnimator.cs index a85a5fc..463dd3f 100644 --- a/1.5/Source/Comps/CompExtendedAnimator.cs +++ b/1.5/Source/Comps/CompExtendedAnimator.cs @@ -51,6 +51,23 @@ namespace Rimworld_Animations { } } + public int AnimationLength + { + get + { + if (!IsAnimating) return 0; + + int groupAnimLength = 0; + foreach(AnimationDef anim in animationQueue) + { + groupAnimLength += anim.durationTicks; + } + + return groupAnimLength; + + } + } + public Vector3 getAnchor() { return anchor.getDrawPos(); @@ -153,6 +170,10 @@ namespace Rimworld_Animations { { PawnRenderNodeProperties props = animationProp.animPropProperties; + if (props.texPath.NullOrEmpty()) + { + 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/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs index 8980cec..07f286f 100644 --- a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs +++ b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs @@ -37,7 +37,7 @@ namespace Rimworld_Animations { bool quickie = (__instance is JobDriver_SexQuick) && AnimationSettings.fastAnimForQuickie; int preAnimDuration = __instance.duration; - int AnimationTimeTicks = 0; + List participants = partnerSexBaseReceiver.parteners.Append(partner).ToList(); @@ -45,16 +45,16 @@ namespace Rimworld_Animations { if (groupAnimation != null) { AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, partner); - } - + int animTicks = AnimationUtility.GetAnimationLength(pawn); - //Modify Orgasm ticks to only orgasm as many times as RJW stock orgasm allows - if (AnimationTimeTicks != 0) - { - __instance.orgasmstick = preAnimDuration * __instance.orgasmstick / AnimationTimeTicks; + foreach(Pawn participant in participants) + { + (participant.jobs.curDriver as JobDriver_Sex).ticks_left = animTicks; + (participant.jobs.curDriver as JobDriver_Sex).sex_ticks = animTicks; + (participant.jobs.curDriver as JobDriver_Sex).orgasmStartTick = animTicks; + (participant.jobs.curDriver as JobDriver_Sex).duration = animTicks; + } } - - } } diff --git a/1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_Animate.cs b/1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_Animate.cs new file mode 100644 index 0000000..eaaf9b1 --- /dev/null +++ b/1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_Animate.cs @@ -0,0 +1,39 @@ +using HarmonyLib; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace Rimworld_Animations +{ + [HarmonyPatch(typeof(JobDriver_Sex), "Animate")] + public class HarmonyPatch_Animate + { + public static bool Prefix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target) + { + //remove all bumping stuff in animations; keep draw nude code + if (target != null) + { + Pawn pawn2 = target as Pawn; + if (!__instance.isEndytophile) + { + SexUtility.DrawNude(pawn, false); + if (pawn2 != null) + { + SexUtility.DrawNude(pawn2, false); + return false; + } + } + } + else if (!__instance.isEndytophile) + { + SexUtility.DrawNude(pawn, false); + } + + return false; + } + } +} diff --git a/1.5/Source/Patches/RJWPatches/HarmonyPatch_PlaySexSounds.cs b/1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_PlaySexSounds.cs similarity index 100% rename from 1.5/Source/Patches/RJWPatches/HarmonyPatch_PlaySexSounds.cs rename to 1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_PlaySexSounds.cs diff --git a/1.5/Source/Patches/RJWPatches/HarmonyPatch_SexTick.cs b/1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_SexTick.cs similarity index 100% rename from 1.5/Source/Patches/RJWPatches/HarmonyPatch_SexTick.cs rename to 1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_SexTick.cs diff --git a/1.5/Source/Patches/RJWPatches/JobDrivers/SexBaseReceivers/HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs b/1.5/Source/Patches/RJWPatches/JobDrivers/SexBaseReceivers/HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs index 6c4faa8..ca4df23 100644 --- a/1.5/Source/Patches/RJWPatches/JobDrivers/SexBaseReceivers/HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs +++ b/1.5/Source/Patches/RJWPatches/JobDrivers/SexBaseReceivers/HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs @@ -1,8 +1,10 @@ using HarmonyLib; +using RimWorld; using rjw; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection.Emit; using System.Text; using System.Threading.Tasks; using Verse.AI; @@ -19,5 +21,32 @@ namespace Rimworld_Animations AnimationUtility.StopGroupAnimation(__instance.pawn); }); } + + public static IEnumerable Transpiler(IEnumerable codeInstructions) + { + + var ins = codeInstructions.ToList(); + for (int i = 0; i < ins.Count; i++) + { + if (i < ins.Count && ins[i].opcode == OpCodes.Call && ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(Toils_LayDown), "LayDown"))) + { + + ins[i].operand = AccessTools.DeclaredMethod(typeof(HarmonyPatch_JobDriver_SexBaseReceiverLoved), "DoNotLayDown"); + yield return ins[i]; + + } + + else + { + yield return ins[i]; + } + } + + } + + public static Toil DoNotLayDown(TargetIndex bedOrRestSpotIndex, bool hasBed, bool lookForOtherJobs, bool canSleep = true, bool gainRestAndHealth = true, PawnPosture noBedLayingPosture = PawnPosture.LayingMask, bool deathrest = false) + { + return new Toil(); + } } } 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..da96fe5 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs @@ -13,6 +13,8 @@ namespace Rimworld_Animations public override bool CanDrawNow(PawnRenderNode node, PawnDrawParms parms) { + if (!base.CanDrawNow(node, parms)) return false; + if (parms.Portrait) return false; //don't draw if not visible at tick @@ -23,21 +25,25 @@ namespace Rimworld_Animations } - return base.CanDrawNow(node, parms); + return true; } protected override Material GetMaterial(PawnRenderNode node, PawnDrawParms parms) { //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); + Material materialVariant = GetMaterialVariant(nodeWithGraphicVariants, parms, (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick)); + if (materialVariant != null) { + return materialVariant; + } + } //otherwise return original texture @@ -47,6 +53,9 @@ namespace Rimworld_Animations public virtual Material GetMaterialVariant(PawnRenderNode_GraphicVariants node, PawnDrawParms parms, int variant) { Material material = node.getGraphicVariant(variant).NodeGetMat(parms); + + if (material == null) return null; + if (material != null && !parms.Portrait && parms.flags.FlagSet(PawnRenderFlags.Invisible)) { material = InvisibilityMatPool.GetInvisibleMat(material); diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs index fa46ce7..24a74d6 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs @@ -11,11 +11,17 @@ 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) { + if (!variants.ContainsKey(variant)) + { + Log.ErrorOnce("[Anims] Error: tried to get key from variants that doesn't exist; key = " + variant, 2043428111); + return null; + } + return variants[variant]; } @@ -38,14 +44,24 @@ 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); + + if (texPathVariants == null) return variantGraphics; //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 +69,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/1.5/Source/Utilities/AnimationUtility.cs b/1.5/Source/Utilities/AnimationUtility.cs index 2431db7..e57a096 100644 --- a/1.5/Source/Utilities/AnimationUtility.cs +++ b/1.5/Source/Utilities/AnimationUtility.cs @@ -95,5 +95,11 @@ namespace Rimworld_Animations { } + + public static int GetAnimationLength(Pawn pawn) + { + return pawn.TryGetComp().AnimationLength; + } + } } diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index e676bbd..bdf8615 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -46,6 +46,7 @@ ..\rjw\1.5\Assemblies\RJW.dll + False ..\rjw-toys-and-masturbation\Assemblies\RJW-ToysAndMasturbation.dll @@ -104,17 +105,22 @@ - - + + + + + + + @@ -126,11 +132,17 @@ - + + + + + + +