diff --git a/Assemblies/RJW-Events.dll b/Assemblies/RJW-Events.dll index 4c12f27..260ac6a 100644 Binary files a/Assemblies/RJW-Events.dll and b/Assemblies/RJW-Events.dll differ diff --git a/RJW-Events.csproj b/RJW-Events.csproj index e5ef7b7..930e0ca 100644 --- a/RJW-Events.csproj +++ b/RJW-Events.csproj @@ -63,6 +63,8 @@ + + diff --git a/Source/JobDrivers/JobDriver_OrgySex.cs b/Source/JobDrivers/JobDriver_OrgySex.cs index d9f0340..500f69a 100644 --- a/Source/JobDrivers/JobDriver_OrgySex.cs +++ b/Source/JobDrivers/JobDriver_OrgySex.cs @@ -23,12 +23,13 @@ namespace RJW_Events { base.setup_ticks(); JobDef PartnerJob = DefDatabase.GetNamed("GettinOrgySex", true); - this.FailOnDespawnedNullOrForbidden(this.iTarget); + this.FailOnDespawnedOrNull(this.iTarget); this.FailOn(() => !this.Partner.health.capacities.CanBeAwake); this.FailOn(() => this.pawn.IsFighting()); this.FailOn(() => this.Partner.IsFighting()); this.FailOn(() => this.pawn.Drafted); - yield return Toils_Goto.GotoThing(this.iTarget, PathEndMode.OnCell); + this.FailOn(() => this.Partner.Drafted); + yield return Toils_Goto.GotoThing(this.iTarget, PathEndMode.ClosestTouch); yield return new Toil { defaultCompleteMode = ToilCompleteMode.Delay, @@ -39,7 +40,7 @@ namespace RJW_Events tickAction = delegate () { this.pawn.GainComfortFromCellIfPossible(false); - if (this.pawn.Position.DistanceTo(this.Partner.Position) <= 1f) + if (this.pawn.Position.DistanceTo(this.Partner.Position) <= 3f) { this.ReadyForNextToil(); } @@ -91,7 +92,7 @@ namespace RJW_Events toil.AddFinishAction(delegate { this.End(); - if(LordUtility.GetLord(pawn)?.CurLordToil != null && !(LordUtility.GetLord(pawn).CurLordToil is LordToil_End)) + if(LordUtility.GetLord(pawn)?.LordJob != null && LordUtility.GetLord(pawn).LordJob is LordJob_Joinable_Orgy && !(LordUtility.GetLord(pawn).CurLordToil is LordToil_End)) SexUtility.DrawNude(pawn); }); yield return toil; diff --git a/Source/JobDrivers/JobDriver_OrgySexReceiver.cs b/Source/JobDrivers/JobDriver_OrgySexReceiver.cs index 4596cd1..112957e 100644 --- a/Source/JobDrivers/JobDriver_OrgySexReceiver.cs +++ b/Source/JobDrivers/JobDriver_OrgySexReceiver.cs @@ -35,6 +35,7 @@ namespace RJW_Events this.ticks_between_hearts -= 25; } this.FailOnDespawnedOrNull(this.iTarget); + this.FailOn(() => !(Partner.jobs.curDriver is JobDriver_Sex)); this.FailOn(() => !base.Partner.health.capacities.CanBeAwake); this.FailOn(() => this.pawn.Drafted); this.FailOn(() => base.Partner.Drafted); @@ -69,7 +70,7 @@ namespace RJW_Events return JobCondition.Succeeded; } return JobCondition.Ongoing; - }); + }); toil.socialMode = RandomSocialMode.Off; return toil; } diff --git a/Source/JobGivers/JobGiver_FindOrgyPartner.cs b/Source/JobGivers/JobGiver_FindOrgyPartner.cs index 2f08b90..d8ae726 100644 --- a/Source/JobGivers/JobGiver_FindOrgyPartner.cs +++ b/Source/JobGivers/JobGiver_FindOrgyPartner.cs @@ -79,6 +79,7 @@ namespace RJW_Events { if(targets.TryRandomElementByWeight((Pawn p) => { + if (p == pawn1) return 0; float chance = pawn1.relations.SecondaryRomanceChanceFactor(p); if(!(p.jobs.curDriver is JobDriver_Sex)) { diff --git a/Source/Patches/HarmonyPatch_ReclotheOnRemovePawn.cs b/Source/Patches/HarmonyPatch_ReclotheOnRemovePawn.cs new file mode 100644 index 0000000..832dc2e --- /dev/null +++ b/Source/Patches/HarmonyPatch_ReclotheOnRemovePawn.cs @@ -0,0 +1,23 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using Verse.AI.Group; + +namespace RJW_Events +{ + [HarmonyPatch(typeof(Lord), "RemovePawn")] + public static class HarmonyPatch_ReclotheOnRemovePawn + { + public static void Postfix(Lord __instance, Pawn p) + { + if(__instance?.LordJob != null && __instance.LordJob is LordJob_Joinable_Orgy) + { + p.Drawer.renderer.graphics.ResolveApparelGraphics(); + } + } + } +} diff --git a/Source/Patches/HarmonyPatch_StayNudeForOrgy.cs b/Source/Patches/HarmonyPatch_StayNudeForOrgy.cs new file mode 100644 index 0000000..10c8196 --- /dev/null +++ b/Source/Patches/HarmonyPatch_StayNudeForOrgy.cs @@ -0,0 +1,24 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using Verse.AI.Group; + +namespace RJW_Events +{ + [HarmonyPatch(typeof(PawnGraphicSet), "ResolveApparelGraphics")] + public static class HarmonyPatch_StayNudeForOrgy + { + public static bool Prefix(PawnGraphicSet __instance) + { + if(LordUtility.GetLord(__instance.pawn)?.LordJob != null && LordUtility.GetLord(__instance.pawn).LordJob is LordJob_Joinable_Orgy) + { + return false; + } + return true; + } + } +}