diff --git a/1.3/Assemblies/Rimworld-Animations.dll b/1.3/Assemblies/Rimworld-Animations.dll index 086d437..53a3c98 100644 Binary files a/1.3/Assemblies/Rimworld-Animations.dll and b/1.3/Assemblies/Rimworld-Animations.dll differ diff --git a/Defs/JobDefs/Jobs_SexForAnim.xml b/Defs/JobDefs/Jobs_SexForAnim.xml deleted file mode 100644 index 20c0bca..0000000 --- a/Defs/JobDefs/Jobs_SexForAnim.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - JoinInBedAnimation - Rimworld_Animations.JobDriver_SexCasualForAnimation - joining someone in bed. - false - - - - GettinLovedAnimation - Rimworld_Animations.JobDriver_SexBaseRecieverLovedForAnimation - lovin'. - false - - diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index 492ca30..77b3693 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -82,31 +82,27 @@ - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + + + + + @@ -120,13 +116,14 @@ - + + \ No newline at end of file diff --git a/Source/JobDrivers/JobDriver_SexBaseRecieverLovedForAnimation.cs b/Source/JobDrivers/JobDriver_SexBaseRecieverLovedForAnimation.cs deleted file mode 100644 index 9efa508..0000000 --- a/Source/JobDrivers/JobDriver_SexBaseRecieverLovedForAnimation.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Collections.Generic; -using RimWorld; -using Verse; -using Verse.AI; -using System; -using rjw; - -namespace Rimworld_Animations { - public class JobDriver_SexBaseRecieverLovedForAnimation : JobDriver_SexBaseReciever { - - public readonly TargetIndex ipartner = TargetIndex.A; - public readonly TargetIndex ibed = TargetIndex.B; - - public override bool TryMakePreToilReservations(bool errorOnFailed) { - - return base.TryMakePreToilReservations(errorOnFailed); - } - - protected override IEnumerable MakeNewToils() { - - - setup_ticks(); - - float partner_ability = xxx.get_sex_ability(Partner); - - // More/less hearts based on partner ability. - if (partner_ability < 0.8f) - ticks_between_thrusts += 100; - else if (partner_ability > 2.0f) - ticks_between_thrusts -= 25; - - // More/less hearts based on opinion. - if (pawn.relations.OpinionOf(Partner) < 0) - ticks_between_hearts += 50; - else if (pawn.relations.OpinionOf(Partner) > 60) - ticks_between_hearts -= 25; - - - parteners.Add(Partner);// add job starter, so this wont fail, before Initiator starts his job - //--Log.Message("[RJW]JobDriver_GettinLoved::MakeNewToils is called"); - - this.FailOnDespawnedOrNull(ipartner); - this.FailOn(() => !Partner.health.capacities.CanBeAwake); - this.FailOn(() => pawn.Drafted); - this.KeepLyingDown(ibed); - yield return Toils_Reserve.Reserve(ipartner, 1, 0); - yield return Toils_Reserve.Reserve(ibed, Bed.SleepingSlotsCount, 0); - - Toil get_loved = new Toil(); - get_loved.FailOn(() => { - - for (int i = 0; i < parteners.Count; i++) - { - if (parteners[i].CurJobDef != DefDatabase.GetNamed("JoinInBedAnimation", true)) - { - return true; - } - } - - return false; - - }); - get_loved.defaultCompleteMode = ToilCompleteMode.Never; - get_loved.socialMode = RandomSocialMode.Off; - get_loved.handlingFacing = true; - get_loved.AddPreTickAction(delegate { - if (pawn.IsHashIntervalTick(ticks_between_hearts)) - FleckMaker.ThrowMetaIcon(pawn.Position, pawn.Map, FleckDefOf.Heart); - - }); - get_loved.AddEndCondition(() => - { - if (parteners.Count <= 0) - { - return JobCondition.Succeeded; - } - return JobCondition.Ongoing; - - }); - get_loved.AddFinishAction(delegate { - if (xxx.is_human(pawn)) - pawn.Drawer.renderer.graphics.ResolveApparelGraphics(); - }); - yield return get_loved; - - - } - } -} \ No newline at end of file diff --git a/Source/JobDrivers/JobDriver_SexCasualForAnimation.cs b/Source/JobDrivers/JobDriver_SexCasualForAnimation.cs deleted file mode 100644 index 285c542..0000000 --- a/Source/JobDrivers/JobDriver_SexCasualForAnimation.cs +++ /dev/null @@ -1,93 +0,0 @@ -using RimWorld; -using rjw; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Verse; -using Verse.AI; - -namespace Rimworld_Animations { - class JobDriver_SexCasualForAnimation : JobDriver_SexBaseInitiator { - - public readonly TargetIndex ipartner = TargetIndex.A; - public readonly TargetIndex ibed = TargetIndex.B; - - public override bool TryMakePreToilReservations(bool errorOnFailed) { - return pawn.Reserve(Target, job, xxx.max_rapists_per_prisoner, 0, null, errorOnFailed); - } - - protected override IEnumerable MakeNewToils() { - setup_ticks(); - this.FailOnDespawnedOrNull(ipartner); - this.FailOnDespawnedOrNull(ibed); - this.FailOn(() => !Partner.health.capacities.CanBeAwake); - - yield return Toils_Reserve.Reserve(ipartner, xxx.max_rapists_per_prisoner, 0, null); - - Toil goToPawnInBed = Toils_Goto.GotoThing(ipartner, PathEndMode.OnCell); - goToPawnInBed.FailOn(() => !RestUtility.InBed(Partner) && Partner.CurJobDef != DefDatabase.GetNamed("GettinLovedAnimation") && !xxx.in_same_bed(Partner, pawn)); - - yield return goToPawnInBed; - - - Toil startPartnerSex = new Toil(); - startPartnerSex.initAction = delegate { - - if(Partner.CurJobDef != DefDatabase.GetNamed("GettinLovedAnimation")) // allows threesomes - { - Job gettinLovedJob = JobMaker.MakeJob(DefDatabase.GetNamed("GettinLovedAnimation"), pawn, Bed); // new gettin loved toil that wakes up the pawn goes here - - Partner.jobs.jobQueue.EnqueueFirst(gettinLovedJob); - Partner.jobs.EndCurrentJob(JobCondition.InterruptForced); - } - - }; - yield return startPartnerSex; - - Toil sexToil = new Toil(); - sexToil.FailOn(() => (Partner.CurJobDef == null) || Partner.CurJobDef != DefDatabase.GetNamed("GettinLovedAnimation", true)); //partner jobdriver is not sexbaserecieverlovedforanim - sexToil.socialMode = RandomSocialMode.Off; - sexToil.defaultCompleteMode = ToilCompleteMode.Never; - sexToil.handlingFacing = true; - sexToil.initAction = delegate { - - usedCondom = (CondomUtility.TryUseCondom(base.pawn) || CondomUtility.TryUseCondom(Partner)); - Start(); - }; - - sexToil.AddPreTickAction(delegate { - - if(!Partner.TryGetComp().isAnimating) - { - pawn.TryGetComp().isAnimating = false; - } - - if(Gen.IsHashIntervalTick(pawn, ticks_between_hearts)) { - FleckMaker.ThrowMetaIcon(pawn.Position, pawn.Map, FleckDefOf.Heart); - } - SexTick(pawn, Partner); - SexUtility.reduce_rest(Partner); - SexUtility.reduce_rest(pawn, 2); - if (ticks_left <= 0) - ReadyForNextToil(); - - }); - sexToil.AddFinishAction(delegate { - - End(); - - }); - yield return sexToil; - - Toil finish = new Toil(); - finish.initAction = delegate { - SexUtility.ProcessSex(pawn, Partner, usedCondom, isRape, isCoreLovin: false, isWhoring, sexType); - }; - finish.defaultCompleteMode = ToilCompleteMode.Instant; - yield return finish; - - } - } -} diff --git a/Source/Patches/HarmonyPatch_AlienRace.cs b/Source/Patches/HarmonyPatch_AlienRace.cs deleted file mode 100644 index 353a717..0000000 --- a/Source/Patches/HarmonyPatch_AlienRace.cs +++ /dev/null @@ -1,92 +0,0 @@ -using HarmonyLib; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Reflection.Emit; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Verse; -using AlienRace; - -namespace Rimworld_Animations { - [HarmonyPatch(typeof(AlienRace.HarmonyPatches), "DrawAddons")] - public static class HarmonyPatch_AlienRace { - - - - public static void RenderHeadAddonInAnimation(Mesh mesh, Vector3 loc, Quaternion quat, Material mat, bool drawNow, Graphic graphic, AlienPartGenerator.BodyAddon bodyAddon, Vector3 v, float num, Vector3 headOffset, Pawn pawn, PawnRenderFlags renderFlags) - { - - CompBodyAnimator pawnAnimator = pawn.TryGetComp(); - if (!renderFlags.FlagSet(PawnRenderFlags.Portrait) && pawnAnimator.isAnimating && (bodyAddon.drawnInBed || bodyAddon.alignWithHead)) - { - - Quaternion headQuatInAnimation = Quaternion.AngleAxis(pawnAnimator.headAngle, Vector3.up); - Rot4 headRotInAnimation = pawnAnimator.headFacing; - Vector3 headPositionInAnimation = pawnAnimator.getPawnHeadPosition() - pawn.Drawer.renderer.BaseHeadOffsetAt(pawnAnimator.headFacing).RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: headQuatInAnimation)) * 2f * 57.29578f); - - Log.Message(bodyAddon.path + " " + bodyAddon.inFrontOfBody.ToStringSafe()); - headPositionInAnimation.y += bodyAddon.inFrontOfBody ? 1f : -1f; - - GenDraw.DrawMeshNowOrLater(mesh: graphic.MeshAt(rot: headRotInAnimation), loc: headPositionInAnimation + (bodyAddon.alignWithHead ? headOffset : Vector3.zero) + v.RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: headQuatInAnimation)) * 2f * 57.29578f), - quat: Quaternion.AngleAxis(angle: num, axis: Vector3.up) * headQuatInAnimation, mat: graphic.MatAt(rot: pawnAnimator.headFacing), drawNow: drawNow); - } - - else - { - GenDraw.DrawMeshNowOrLater(mesh, loc, quat, mat, drawNow); - } - } - - - public static IEnumerable Transpiler(IEnumerable instructions) - { - List ins = instructions.ToList(); - for (int i = 0; i < ins.Count; i++) - { - - Type[] type = new Type[] { typeof(Mesh), typeof(Vector3), typeof(Quaternion), typeof(Material), typeof(bool) }; - - - if (ins[i].OperandIs(AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater", type))) - { - - yield return new CodeInstruction(OpCodes.Ldloc, (object)7); //graphic - yield return new CodeInstruction(OpCodes.Ldloc, (object)4); //bodyAddon - yield return new CodeInstruction(OpCodes.Ldloc, (object)5); //offsetVector/AddonOffset (v) - yield return new CodeInstruction(OpCodes.Ldloc, (object)6); //num - yield return new CodeInstruction(OpCodes.Ldarg, (object)2); //headOffset - yield return new CodeInstruction(OpCodes.Ldarg, (object)3); //pawn - yield return new CodeInstruction(OpCodes.Ldarg, (object)0); //renderflags - - yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(HarmonyPatch_AlienRace), "RenderHeadAddonInAnimation")); - - } - - else - { - yield return ins[i]; - } - - - } - } - - } - - [HarmonyPatch(typeof(PawnGraphicSet), "ResolveApparelGraphics")] - public static class HarmonyPatch_ResolveApparelGraphics - { - public static bool Prefix(ref Pawn ___pawn) - { - - if (___pawn.TryGetComp() != null && ___pawn.TryGetComp().isAnimating) - { - return false; - } - return true; - } - } -} \ No newline at end of file diff --git a/Source/Patches/HarmonyPatch_CSL.cs b/Source/Patches/HarmonyPatch_CSL.cs deleted file mode 100644 index 8345ede..0000000 --- a/Source/Patches/HarmonyPatch_CSL.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using HarmonyLib; -using rjw; -using Verse; -using RimWorld; -using System.Reflection.Emit; -using System.Reflection; -using UnityEngine; - -namespace Rimworld_Animations { - [StaticConstructorOnStartup] - public static class HarmonyPatch_CSL { - static HarmonyPatch_CSL() { - try { - ((Action)(() => { - if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "Children, school and learning")) { - - (new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("Children.PawnRenderer_RenderPawnInternal_Patch"), "RenderPawnInternalScaled"), - prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_CSL), "Prefix_CSL")), - transpiler: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_CSL), "Transpiler_CSL"))); - } - }))(); - } - catch (TypeLoadException ex) { - - } - } - - public static void Prefix_CSL(PawnRenderer __instance, Pawn pawn, ref Vector3 rootLoc, ref float angle, bool renderBody, ref Rot4 bodyFacing, ref Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump, bool invisible) { - - PawnGraphicSet graphics = __instance.graphics; - CompBodyAnimator bodyAnim = pawn.TryGetComp(); - - if (!graphics.AllResolved) { - graphics.ResolveAllGraphics(); - } - - - if (bodyAnim != null && bodyAnim.isAnimating && !portrait) { - bodyAnim.tickGraphics(graphics); - pawn.TryGetComp().animatePawn(ref rootLoc, ref angle, ref bodyFacing, ref headFacing); - - } - } - - public static IEnumerable Transpiler_CSL(IEnumerable instructions) { - - MethodInfo drawMeshNowOrLater = AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater"); - FieldInfo headGraphic = AccessTools.Field(typeof(PawnGraphicSet), "headGraphic"); - - - List codes = instructions.ToList(); - bool forHead = true; - for (int i = 0; i < codes.Count(); i++) { - - //Instead of calling drawmeshnoworlater, add pawn to the stack and call my special static method - if (codes[i].OperandIs(drawMeshNowOrLater) && forHead) { - - yield return new CodeInstruction(OpCodes.Ldarg_0); - yield return new CodeInstruction(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PawnRenderer), "pawn")); - yield return new CodeInstruction(OpCodes.Ldarg_2); - yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(AnimationUtility), nameof(AnimationUtility.RenderPawnHeadMeshInAnimation), new Type[] { typeof(Mesh), typeof(Vector3), typeof(Quaternion), typeof(Material), typeof(bool), typeof(Pawn), typeof(float) })); - - } - //checking for if(graphics.headGraphic != null) - else if (codes[i].opcode == OpCodes.Ldfld && codes[i].OperandIs(headGraphic)) { - forHead = true; - yield return codes[i]; - } - //checking for if(renderbody) - else if (codes[i].opcode == OpCodes.Ldarg_3) { - forHead = false; - yield return codes[i]; - } - else { - yield return codes[i]; - } - } - } - - } -}*/ diff --git a/Source/Patches/HarmonyPatch_DontShaveYourHead.cs b/Source/Patches/HarmonyPatch_DontShaveYourHead.cs deleted file mode 100644 index fa5a5cc..0000000 --- a/Source/Patches/HarmonyPatch_DontShaveYourHead.cs +++ /dev/null @@ -1,29 +0,0 @@ -using HarmonyLib; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Verse; - -namespace Rimworld_Animations { - class HarmonyPatch_DontShaveYourHead { - - [StaticConstructorOnStartup] - public static class Patch_DontShaveYourHead { - - static Patch_DontShaveYourHead() { - try { - ((Action)(() => - { - if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "Don't Shave Your Head 1.0")) { - (new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("DontShaveYourHead.Harmony_PawnRenderer"), "DrawHairReroute"), //typeof(ShowHair.Patch_PawnRenderer_RenderPawnInternal), nameof(ShowHair.Patch_PawnRenderer_RenderPawnInternal.Postfix)), - transpiler: new HarmonyMethod(AccessTools.Method(typeof(Patch_ShowHairWithHats), "Transpiler"))); - } - }))(); - } - catch (TypeLoadException ex) { } - } - } - } -} diff --git a/Source/Patches/HarmonyPatch_FacialAnimation.cs b/Source/Patches/HarmonyPatch_FacialAnimation.cs deleted file mode 100644 index 9c01ccb..0000000 --- a/Source/Patches/HarmonyPatch_FacialAnimation.cs +++ /dev/null @@ -1,104 +0,0 @@ -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 UnityEngine; -using Verse; - -namespace Rimworld_Animations { - [StaticConstructorOnStartup] - public static class Patch_FacialAnimation { - - static Patch_FacialAnimation() { - try { - ((Action)(() => { - if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "[NL] Facial Animation - WIP")) { - (new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("FacialAnimation.DrawFaceGraphicsComp"), "DrawGraphics"), - prefix: new HarmonyMethod(AccessTools.Method(typeof(Patch_FacialAnimation), "Prefix"))); - } - }))(); - } - catch (TypeLoadException ex) { - - } - } - - public static bool Prefix(ref Pawn ___pawn, ref Rot4 headFacing, ref Vector3 headOrigin, ref Quaternion quaternion, ref bool portrait) { - - CompBodyAnimator bodyAnim = ___pawn.TryGetComp(); - - if (bodyAnim != null && bodyAnim.isAnimating && !portrait) { - - headFacing = bodyAnim.headFacing; - headOrigin = new Vector3(bodyAnim.getPawnHeadPosition().x, headOrigin.y, bodyAnim.getPawnHeadPosition().z); - quaternion = Quaternion.AngleAxis(bodyAnim.headAngle, Vector3.up); - } - - return true; - } - /* - public static List rjwLovinDefNames = new List{ - "Lovin", - "Quickie", - "GettingQuickie", - "JoinInBed", - "JoinInBedAnimation", - "GettinLovedAnimation", - "GettinLoved", - "GettinLicked", - "GettinSucked", - "GettinRaped", - "ViolateCorpse", - "RJW_Masturbate", - "GettinBred", - "Breed", - "RJW_Mate", - "Bestiality", - "BestialityForFemale", - "StruggleInBondageGear", - "WhoreIsServingVisitors", - "UseFM" - }; - - public static List rjwRapeDefNames = new List { - "RapeComfortPawn", - "RandomRape", - "RapeEnemy" - }; - - public static bool Prefix_IsSameA(JobDef job, string ___jobDef, ref bool __result) { - - if(___jobDef != null && ___jobDef == "Lovin" && job?.defName != null && rjwLovinDefNames.Contains(job?.defName)) { - __result = true; - return false; - } - else if (___jobDef != null && ___jobDef == "Wait_Combat" && job?.defName != null && rjwRapeDefNames.Contains(job?.defName)) { - __result = true; - return false; - } - - - return true; - } - - public static bool Prefix_IsSameB(string jobName, string ___jobDef, ref bool __result) { - - if (___jobDef != null && ___jobDef == "Lovin" && jobName != null && rjwLovinDefNames.Contains(jobName)) { - __result = true; - return false; - } - if (___jobDef != null && ___jobDef == "Wait_Combat" && jobName != null && rjwRapeDefNames.Contains(jobName)) { - __result = true; - return false; - } - - return true; - } - */ - } -} \ No newline at end of file diff --git a/Source/Patches/HarmonyPatch_SetPawnLaying.cs b/Source/Patches/HarmonyPatch_SetPawnLaying.cs deleted file mode 100644 index 1eef30f..0000000 --- a/Source/Patches/HarmonyPatch_SetPawnLaying.cs +++ /dev/null @@ -1,28 +0,0 @@ -using HarmonyLib; -using Verse; -using RimWorld; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Rimworld_Animations -{ - [HarmonyPatch(typeof(PawnUtility), "GetPosture")] - public static class HarmonyPatch_SetPawnLaying - { - - public static bool Prefix(Pawn p, ref PawnPosture __result) - { - if(p.TryGetComp().isAnimating) - { - __result = PawnPosture.LayingOnGroundNormal; - return false; - } - - return true; - } - - } -} diff --git a/Source/Patches/HarmonyPatch_ShowHairWithHats.cs b/Source/Patches/HarmonyPatch_ShowHairWithHats.cs deleted file mode 100644 index 3714503..0000000 --- a/Source/Patches/HarmonyPatch_ShowHairWithHats.cs +++ /dev/null @@ -1,51 +0,0 @@ -using HarmonyLib; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Reflection.Emit; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Verse; - -namespace Rimworld_Animations { - [StaticConstructorOnStartup] - public static class Patch_ShowHairWithHats { - - static Patch_ShowHairWithHats() { - try { - ((Action)(() => - { - if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "[KV] Show Hair With Hats or Hide All Hats - 1.1")) { - (new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("ShowHair.Patch_PawnRenderer_RenderPawnInternal"), "Postfix"), //typeof(ShowHair.Patch_PawnRenderer_RenderPawnInternal), nameof(ShowHair.Patch_PawnRenderer_RenderPawnInternal.Postfix)), - transpiler: new HarmonyMethod(AccessTools.Method(typeof(Patch_ShowHairWithHats), "Transpiler"))); - } - }))(); - } - catch (TypeLoadException ex) { } - } - - - public static IEnumerable Transpiler(IEnumerable instructions) { - - MethodInfo drawMeshNowOrLater = AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater"); - - List codes = instructions.ToList(); - for (int i = 0; i < codes.Count(); i++) { - - //Instead of calling drawmeshnoworlater, add pawn to the stack and call my special static method - if (codes[i].OperandIs(drawMeshNowOrLater)) { - - yield return new CodeInstruction(OpCodes.Ldarg_0); - yield return new CodeInstruction(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PawnRenderer), "pawn")); - yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(AnimationUtility), nameof(AnimationUtility.RenderPawnHeadMeshInAnimation), new Type[] { typeof(Mesh), typeof(Vector3), typeof(Quaternion), typeof(Material), typeof(bool), typeof(Pawn) })); - - } - else { - yield return codes[i]; - } - } - } - } -} diff --git a/Source/Patches/HarmonyPatch_HatsDisplaySelection.cs b/Source/Patches/OtherModPatches/HarmonyPatch_HatsDisplaySelection.cs similarity index 100% rename from Source/Patches/HarmonyPatch_HatsDisplaySelection.cs rename to Source/Patches/OtherModPatches/HarmonyPatch_HatsDisplaySelection.cs diff --git a/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_JoinInBed.cs b/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_JoinInBed.cs new file mode 100644 index 0000000..1c7a7ec --- /dev/null +++ b/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_JoinInBed.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using RimWorld; +using Verse; +using rjw; +using System.Reflection.Emit; +using Verse.AI; + +namespace Rimworld_Animations +{ + + [HarmonyPatch(typeof(xxx), "in_same_bed")] + public static class HarmonyPatch_JobDriver_InSameBedPatch + { + + public static bool Prefix(Pawn partner, ref bool __result) + { + + if(partner != null && partner.CurJobDef == xxx.casual_sex) + { + __result = true; + return false; + } + + return true; + + } + + + + } + + [HarmonyPatch(typeof(JobDriver_JoinInBed), "MakeNewToils")] + public static class HarmonyPatch_JobDriver_JoinInBed + { + + public static void Postfix(JobDriver_JoinInBed __instance, ref IEnumerable __result) + { + + var toils = __result.ToList(); + + Toil goToPawnInBed = Toils_Goto.GotoThing(__instance.iTarget, PathEndMode.OnCell); + goToPawnInBed.FailOn(() => !RestUtility.InBed(__instance.Partner) && __instance.Partner.CurJobDef != xxx.gettin_loved && !xxx.in_same_bed(__instance.Partner, __instance.pawn)); + + toils[1] = goToPawnInBed; + + + Toil startPartnerSex = new Toil(); + startPartnerSex.initAction = delegate { + + + if (!(__instance.Partner.jobs.curDriver is JobDriver_SexBaseReciever)) // allows threesomes + { + Job gettinLovedJob = JobMaker.MakeJob(xxx.gettin_loved, __instance.pawn, __instance.Bed); // new gettin loved toil that wakes up the pawn goes here + __instance.Partner.jobs.jobQueue.EnqueueFirst(gettinLovedJob); + __instance.Partner.jobs.EndCurrentJob(JobCondition.InterruptForced); + } + + }; + + toils[2] = startPartnerSex; + + toils[3].AddPreTickAction(() => + { + if (!__instance.Partner.TryGetComp().isAnimating) + { + __instance.pawn.TryGetComp().isAnimating = false; + } + }); + + + __result = toils.AsEnumerable(); + + + } + + + + } +} diff --git a/Source/Patches/rjwPatches/HarmonyPatch_JobDriver_SexBaseInitiator.cs b/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs similarity index 87% rename from Source/Patches/rjwPatches/HarmonyPatch_JobDriver_SexBaseInitiator.cs rename to Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs index 8a38ca1..6426d93 100644 --- a/Source/Patches/rjwPatches/HarmonyPatch_JobDriver_SexBaseInitiator.cs +++ b/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs @@ -25,30 +25,10 @@ namespace Rimworld_Animations { Building_Bed bed = __instance.Bed; - /* - if (__instance is JobDriver_BestialityForFemale) - bed = (__instance as JobDriver_BestialityForFemale).Bed; - else if (__instance is JobDriver_WhoreIsServingVisitors) { - bed = (__instance as JobDriver_WhoreIsServingVisitors).Bed; - } - else if (__instance is JobDriver_SexCasualForAnimation) { - bed = (__instance as JobDriver_SexCasualForAnimation).Bed; - } - else if (__instance is JobDriver_Masturbate) - bed = (__instance as JobDriver_Masturbate).Bed; - else if (__instance is JobDriver_Rape) - bed = (__instance?.Partner?.jobs?.curDriver as JobDriver_Sex)?.Bed; - - */ - if ((__instance.Target as Pawn)?.jobs?.curDriver is JobDriver_SexBaseReciever) { Pawn Target = __instance.Target as Pawn; - if (!(Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Contains(pawn)) { - (Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Add(pawn); - } - bool quickie = (__instance is JobDriver_SexQuick) && AnimationSettings.fastAnimForQuickie; int preAnimDuration = __instance.duration; diff --git a/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs b/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs new file mode 100644 index 0000000..d328d2b --- /dev/null +++ b/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using RimWorld; +using Verse; +using rjw; +using System.Reflection.Emit; + +namespace Rimworld_Animations +{ + + [HarmonyPatch(typeof(JobDriver_SexBaseRecieverLoved), "MakeSexToil")] + public static class HarmonyPatch_JobDriver_SexBaseReceiverLoved + { + + public static IEnumerable Transpiler(IEnumerable codeInstructions) + { + + var ins = codeInstructions.ToList(); + for(int i = 0; i < ins.Count; i++) + { + if(i + 13 < ins.Count && ins[i + 13].opcode == OpCodes.Call && ins[i + 13].OperandIs(AccessTools.DeclaredMethod(typeof(Toils_LayDown), "LayDown"))) { + + ins.RemoveRange(i, 14); + + } + + else + { + yield return ins[i]; + } + } + + } + + } +} diff --git a/Source/Patches/HarmonyPatch_HeadHair.cs b/Source/Patches/RimworldPatches/HarmonyPatch_HeadHair.cs similarity index 100% rename from Source/Patches/HarmonyPatch_HeadHair.cs rename to Source/Patches/RimworldPatches/HarmonyPatch_HeadHair.cs diff --git a/Source/Patches/HarmonyPatch_PawnRenderer.cs b/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs similarity index 100% rename from Source/Patches/HarmonyPatch_PawnRenderer.cs rename to Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs diff --git a/Source/Patches/HarmonyPatch_PawnRotation.cs b/Source/Patches/RimworldPatches/HarmonyPatch_PawnRotation.cs similarity index 100% rename from Source/Patches/HarmonyPatch_PawnRotation.cs rename to Source/Patches/RimworldPatches/HarmonyPatch_PawnRotation.cs diff --git a/Source/Patches/HarmonyPatch_Pawn_DrawTracker.cs b/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs similarity index 100% rename from Source/Patches/HarmonyPatch_Pawn_DrawTracker.cs rename to Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs diff --git a/Source/Patches/HarmonyPatch_SetPawnAnimatable.cs b/Source/Patches/RimworldPatches/HarmonyPatch_SetPawnAnimatable.cs similarity index 100% rename from Source/Patches/HarmonyPatch_SetPawnAnimatable.cs rename to Source/Patches/RimworldPatches/HarmonyPatch_SetPawnAnimatable.cs diff --git a/Source/Patches/rjwPatches/HarmonyPatch_DoLovinAnimationPatch.cs b/Source/Patches/rjwPatches/HarmonyPatch_DoLovinAnimationPatch.cs deleted file mode 100644 index c508266..0000000 --- a/Source/Patches/rjwPatches/HarmonyPatch_DoLovinAnimationPatch.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using HarmonyLib; -using RimWorld; -using Verse; -using rjw; -using Verse.AI; - -namespace Rimworld_Animations { - - [HarmonyPatch(typeof(JobGiver_DoLovin), "TryGiveJob")] - public static class HarmonyPatch_DoLovinAnimationPatch { - - public static void Postfix(ref Pawn pawn, ref Job __result) { - - if(__result != null) { - Pawn partnerInMyBed = LovePartnerRelationUtility.GetPartnerInMyBed(pawn); - RestUtility.WakeUp(pawn); - __result = JobMaker.MakeJob(DefDatabase.GetNamed("JoinInBedAnimation", true), partnerInMyBed, partnerInMyBed.CurrentBed()); - } - } - } -} diff --git a/Source/Patches/rjwPatches/HarmonyPatch_DrawSemen.cs b/Source/Patches/rjwPatches/HarmonyPatch_DrawSemen.cs deleted file mode 100644 index 2d291d3..0000000 --- a/Source/Patches/rjwPatches/HarmonyPatch_DrawSemen.cs +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Todo: Ask to make SemenSplatch and DrawSemen public - * - * - * using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using rjw; -using HarmonyLib; - -namespace Rimworld_Animations { - [HarmonyPatch("DrawSemen")] - public static class HarmonyPatch_DrawSemen { - - public static void Prefix(ref Dictionary) { - - } - - } -}*/ diff --git a/Source/Patches/rjwPatches/HarmonyPatch_JoinInBedGiveJob.cs b/Source/Patches/rjwPatches/HarmonyPatch_JoinInBedGiveJob.cs deleted file mode 100644 index f46f401..0000000 --- a/Source/Patches/rjwPatches/HarmonyPatch_JoinInBedGiveJob.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using rjw; -using Verse; -using Verse.AI; -using RimWorld; -using HarmonyLib; - -namespace Rimworld_Animations { - [HarmonyPatch(typeof(JobGiver_JoinInBed), "TryGiveJob")] - public static class HarmonyPatch_JoinInBedGiveJob { - - public static bool Prefix(ref Job __result, ref Pawn pawn) { - - __result = null; - - if (!RJWHookupSettings.HookupsEnabled) - return false; - - if (pawn.Drafted) - return false; - - if (!SexUtility.ReadyForHookup(pawn)) - return false; - - // We increase the time right away to prevent the fairly expensive check from happening too frequently - SexUtility.IncreaseTicksToNextHookup(pawn); - - // If the pawn is a whore, or recently had sex, skip the job unless they're really horny - if (!xxx.is_frustrated(pawn) && (xxx.is_whore(pawn) || !SexUtility.ReadyForLovin(pawn))) - return false; - - // This check attempts to keep groups leaving the map, like guests or traders, from turning around to hook up - if (pawn.mindState?.duty?.def == DutyDefOf.TravelOrLeave) { - // TODO: Some guest pawns keep the TravelOrLeave duty the whole time, I think the ones assigned to guard the pack animals. - // That's probably ok, though it wasn't the intention. - if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"JoinInBed.TryGiveJob:({xxx.get_pawnname(pawn)}): has TravelOrLeave, no time for lovin [ANIM JOBGIVER]!"); - return false; - } - - if ((pawn.CurJob == null || pawn.CurJob.def == JobDefOf.LayDown) && CasualSex_Helper.CanHaveSex(pawn)) { - //--Log.Message(" finding partner"); - Pawn partner = CasualSex_Helper.find_partner(pawn, pawn.Map, bedsex: true); - - //--Log.Message(" checking partner"); - if (partner == null) - return false; - - // Can never be null, since find checks for bed. - Building_Bed bed = partner.CurrentBed(); - - // Interrupt current job. - if (pawn.CurJob != null && pawn.jobs.curDriver != null) - pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced); - - __result = JobMaker.MakeJob(DefDatabase.GetNamed("JoinInBedAnimation", true), partner, bed); - return false; - } - - return false; - - } - - } -} diff --git a/Source/Patches/rjwPatches/HarmonyPatch_PlayAnimJoinInBedRMB.cs b/Source/Patches/rjwPatches/HarmonyPatch_PlayAnimJoinInBedRMB.cs deleted file mode 100644 index 5fa4cd8..0000000 --- a/Source/Patches/rjwPatches/HarmonyPatch_PlayAnimJoinInBedRMB.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using RimWorld; -using Verse.AI; -using rjw; -using HarmonyLib; -using Verse; - -namespace Rimworld_Animations { - - [HarmonyPatch(typeof(Pawn_JobTracker), "TryTakeOrderedJob")] - class HarmonyPatch_PlayAnimJoinInBedRMB { - public static void Prefix(ref Job job) { - if(job.def == xxx.casual_sex) { - if (AnimationSettings.debugMode || RJWSettings.DevMode) - Log.Message("Replacing vanilla RJW JoinInBed JobDriver for animation JobDriver"); - job = new Job(DefDatabase.GetNamed("JoinInBedAnimation", true), job.targetA, job.targetB, job.targetC); - } - - } - - } -}