rimworld-animations/Source/Patches/rjwPatches/HarmonyPatch_SexTick.cs

54 lines
1.2 KiB
C#
Raw Normal View History

2020-04-09 00:43:01 +00:00
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.Sound;
namespace Rimworld_Animations {
2020-04-26 15:03:57 +00:00
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
public static class HarmonyPatch_SexTick {
2020-04-09 00:43:01 +00:00
2020-04-26 15:03:57 +00:00
public static bool Prefix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target, ref bool pawnnude, ref bool partnernude) {
2020-04-09 00:43:01 +00:00
2020-04-26 15:03:57 +00:00
Pawn pawn2 = target as Pawn;
2020-05-29 20:12:35 +00:00
if (pawn == null || pawn2 == null) {
return true;
}
2020-04-26 15:03:57 +00:00
if (pawn.IsHashIntervalTick(__instance.ticks_between_thrusts)) {
2020-04-09 00:43:01 +00:00
2020-07-11 16:25:13 +00:00
__instance.ChangePsyfocus(pawn, pawn2);
2020-04-26 15:03:57 +00:00
__instance.Animate(pawn, pawn2);
2020-07-11 21:20:12 +00:00
if (!AnimationSettings.soundOverride || pawn.TryGetComp<CompBodyAnimator>() == null || !pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
2020-04-26 15:03:57 +00:00
__instance.PlaySexSound();
}
if (!__instance.isRape) {
pawn.GainComfortFromCellIfPossible();
pawn2?.GainComfortFromCellIfPossible();
}
2020-04-09 00:43:01 +00:00
}
2020-04-26 15:03:57 +00:00
if (!xxx.has_quirk(pawn, "Endytophile")) {
if (pawnnude) {
SexUtility.DrawNude(pawn);
}
if (pawn2 != null && partnernude) {
SexUtility.DrawNude(pawn2);
}
2020-04-09 00:43:01 +00:00
}
return false;
}
2020-04-26 15:03:57 +00:00
}
2020-04-09 00:43:01 +00:00
}