diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll index 1f8be2a..d9422cd 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 d41bde0..23b5562 100644 --- a/1.5/Defs/AnimationDefs/Cowgirl/AnimationPropDef_Cowgirl_Xray.xml +++ b/1.5/Defs/AnimationDefs/Cowgirl/AnimationPropDef_Cowgirl_Xray.xml @@ -19,8 +19,8 @@ Head 95 TexPathVariants_Cowgirl_Xray - - + + diff --git a/1.5/Defs/AnimationDefs/Cowgirl/GroupAnimation_Cowgirl.xml b/1.5/Defs/AnimationDefs/Cowgirl/GroupAnimation_Cowgirl.xml index a4d5f1c..e5ccdec 100644 --- a/1.5/Defs/AnimationDefs/Cowgirl/GroupAnimation_Cowgirl.xml +++ b/1.5/Defs/AnimationDefs/Cowgirl/GroupAnimation_Cowgirl.xml @@ -98,6 +98,8 @@ --> + +
  • Offset_Placeholder
  • Offset_Cowgirl_Top
  • diff --git a/1.5/Defs/AnimationDefs/DoublePenetration/GroupAnimation_DP.xml b/1.5/Defs/AnimationDefs/DoublePenetration/GroupAnimation_DP.xml index 97d1b7d..60f898d 100644 --- a/1.5/Defs/AnimationDefs/DoublePenetration/GroupAnimation_DP.xml +++ b/1.5/Defs/AnimationDefs/DoublePenetration/GroupAnimation_DP.xml @@ -71,6 +71,11 @@
  • 1 + +
  • +
  • +
  • + 2
  • Sex_DoublePenetration
  • @@ -85,6 +90,11 @@
  • 1 + +
  • +
  • +
  • +
  • Sex_Reverse_DoublePenetration
  • Sex_Reverse_DoublePenetrationM
  • @@ -115,6 +125,8 @@ + + GroupAnimation_DP_Stage2_Branch1 3 @@ -143,7 +155,6 @@ - GroupAnimation_DP_Stage2_Branch2 3 diff --git a/1.5/Source/Animations/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs b/1.5/Source/Animations/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs index 19f475d..de5ddc3 100644 --- a/1.5/Source/Animations/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs +++ b/1.5/Source/Animations/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs @@ -11,13 +11,46 @@ namespace Rimworld_Animations { public int actorShift = 0; public int priority = 0; + + public List whitelist; + public List blacklist; + public virtual bool CanAnimationBeUsed(List actors, int numActors) { + if (numActors != actors.Count) { 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; } public virtual int AnimationReorder() diff --git a/1.5/Source/Animations/PawnTests/BasePawnTest.cs b/1.5/Source/Animations/PawnTests/BasePawnTest.cs new file mode 100644 index 0000000..9ada366 --- /dev/null +++ b/1.5/Source/Animations/PawnTests/BasePawnTest.cs @@ -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); + + } +} diff --git a/1.5/Source/Animations/PawnTests/PawnTest_Always.cs b/1.5/Source/Animations/PawnTests/PawnTest_Always.cs new file mode 100644 index 0000000..198f71b --- /dev/null +++ b/1.5/Source/Animations/PawnTests/PawnTest_Always.cs @@ -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; + } + } +} diff --git a/1.5/Source/Animations/PawnTests/PawnTest_Multi.cs b/1.5/Source/Animations/PawnTests/PawnTest_Multi.cs new file mode 100644 index 0000000..8c854a2 --- /dev/null +++ b/1.5/Source/Animations/PawnTests/PawnTest_Multi.cs @@ -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 tests = new List(); + 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; + } + } +} diff --git a/1.5/Source/Animations/PawnTests/PawnTest_RJWCanBeFucked.cs b/1.5/Source/Animations/PawnTests/PawnTest_RJWCanBeFucked.cs new file mode 100644 index 0000000..044b9c9 --- /dev/null +++ b/1.5/Source/Animations/PawnTests/PawnTest_RJWCanBeFucked.cs @@ -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); + } + } +} diff --git a/1.5/Source/Animations/PawnTests/PawnTest_RJWCanFuck.cs b/1.5/Source/Animations/PawnTests/PawnTest_RJWCanFuck.cs new file mode 100644 index 0000000..7ef9c55 --- /dev/null +++ b/1.5/Source/Animations/PawnTests/PawnTest_RJWCanFuck.cs @@ -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); + } + } +} diff --git a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs index 4331046..b7b7f61 100644 --- a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs +++ b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs @@ -22,8 +22,8 @@ namespace Rimworld_Animations public override Vector3 getDrawPos() { - //vector3.up means stand above the thing - return thing.DrawPos; + //x and z position, regular altitude for pawns + return new Vector3(thing.DrawPos.x, AltitudeLayer.Pawn.AltitudeFor(), thing.DrawPos.z); } public override void ExposeData() diff --git a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs index ffb84ab..7eb5ed8 100644 --- a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs +++ b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs @@ -16,7 +16,8 @@ namespace Rimworld_Animations private Vector3 position; 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() 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 index eaaf9b1..4de97aa 100644 --- a/1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_Animate.cs +++ b/1.5/Source/Patches/RJWPatches/JobDrivers/JobDriver_Sex/HarmonyPatch_Animate.cs @@ -15,9 +15,23 @@ namespace Rimworld_Animations public static bool Prefix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target) { //remove all bumping stuff in animations; keep draw nude code + __instance.RotatePawns(pawn, __instance.Partner); if (target != null) { 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) { SexUtility.DrawNude(pawn, false); diff --git a/1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs b/1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs index fac9115..0716cb8 100644 --- a/1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs +++ b/1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs @@ -16,6 +16,7 @@ namespace Rimworld_Animations { //probably move this setting to a different mod menu if moving rjw parts of code public static bool playHumanlikeVoicesAsDefault = true; + public static float floatRangeInRenderTreeMenu = 1f; public static bool offsetTab = false, debugMode = false; public static float shiverIntensity = 2f; @@ -34,6 +35,7 @@ namespace Rimworld_Animations { Scribe_Values.Look(ref PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs"); Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true); Scribe_Values.Look(ref shiverIntensity, "RJWAnimations-shiverIntensity", 2f); + Scribe_Values.Look(ref floatRangeInRenderTreeMenu, "RJWAnimations-FloatRangeRenderMenu", 1f); //todo: save offsetsByDefName } @@ -63,6 +65,9 @@ namespace Rimworld_Animations { listingStandard.Label("RimAnim_ShiverIntensity".Translate() + RJWAnimationSettings.shiverIntensity); 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); diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Dialog_DebugRenderTree.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Dialog_DebugRenderTree.cs new file mode 100644 index 0000000..eadccea --- /dev/null +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Dialog_DebugRenderTree.cs @@ -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 Transpiler(IEnumerable instructions) + { + var codes = new List(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); + } + + } +} diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs index 7e30364..7f78668 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs @@ -21,6 +21,8 @@ namespace Rimworld_Animations if (__instance.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker) { + if (parms.Portrait) return true; + // ADJUST FACING get rotated textures // compare the previous tick to the current tick; if the current tick rotation is different, recache parms.facing = extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick); diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs index c3cca54..470b3d3 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs @@ -20,6 +20,10 @@ namespace Rimworld_Animations * Facing offsets fix */ //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; while (animatingNode != null && !(animatingNode.AnimationWorker is AnimationWorker_KeyframesExtended)) diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs index a013ea7..7aced9a 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs @@ -15,7 +15,7 @@ namespace Rimworld_Animations { 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) { __result = 0; diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs index 31c4692..4ad7419 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs @@ -12,13 +12,21 @@ namespace Rimworld_Animations { public static void Postfix(ref Pawn ___pawn, ref Vector3 __result) { //align pos on top of partner, position, etc., based on animatoranchor - if (___pawn.TryGetComp() is CompExtendedAnimator animator - && animator.IsAnchored) + if (___pawn.TryGetComp() is CompExtendedAnimator animator) { - Vector3 anchor = animator.getAnchor(); - //ignore y so that pawns don't clip through stuff - __result.x = anchor.x; - __result.z = anchor.z; + if (animator.IsAnchored) + { + Vector3 anchor = animator.getAnchor(); + __result.x = anchor.x; + __result.y = anchor.y; + __result.z = anchor.z; + } + else + { + __result.y = AltitudeLayer.Pawn.AltitudeFor(); + } + + } } diff --git a/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_HideWhenAnimating.cs b/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_HideWhenAnimating.cs index 57c174d..74bc599 100644 --- a/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_HideWhenAnimating.cs +++ b/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_HideWhenAnimating.cs @@ -14,6 +14,8 @@ namespace Rimworld_Animations 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 || 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) { + base.TransformLayer(node, parms, ref layer); + + if (node.tree.pawn.def != ThingDefOf.Human) return; layer -= 1000; } diff --git a/Languages/English/Keyed/RJWAnimations-LanguageData.xml b/Languages/English/Keyed/RJWAnimations-LanguageData.xml index 7227181..bdd8344 100644 --- a/Languages/English/Keyed/RJWAnimations-LanguageData.xml +++ b/Languages/English/Keyed/RJWAnimations-LanguageData.xml @@ -19,6 +19,7 @@ Warning--You generally don't want to change human offsets, only alien offsets or animals Copy Offset to Clipboard Paste offset values in OffsetDef, or share in Discord + Float range for Debug Render Tree offset menu \ No newline at end of file diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index e27cfbc..e57bad2 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -84,6 +84,11 @@ + + + + + @@ -104,6 +109,7 @@ +