diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll index 56a78fd..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/Source/Comps/CompExtendedAnimator.cs b/1.5/Source/Comps/CompExtendedAnimator.cs index 2c57aa8..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(); 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/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 2ab9ff6..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,8 +105,9 @@ - - + + +