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

62 lines
1.4 KiB
C#
Raw Normal View History

using HarmonyLib;
using RimWorld;
using rjw;
using System;
2020-04-09 00:43:01 +00:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using Verse.AI;
2020-04-09 00:43:01 +00:00
namespace Rimworld_Animations
{
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
public class HarmonyPatch_SexTick
{
public static bool Prefix(JobDriver_Sex __instance, Pawn pawn, Thing target)
{
2020-04-09 00:43:01 +00:00
if ((target is Pawn) &&
!(
(target as Pawn)?.jobs?.curDriver is JobDriver_SexBaseReciever
&&
((target as Pawn).jobs.curDriver as JobDriver_SexBaseReciever).parteners.Any()
&&
((target as Pawn).jobs.curDriver as JobDriver_SexBaseReciever).parteners[0] == pawn))
{
2020-04-09 00:43:01 +00:00
__instance.ticks_left--;
__instance.sex_ticks--;
__instance.Orgasm();
2020-05-29 20:12:35 +00:00
if (pawn.IsHashIntervalTick(__instance.ticks_between_thrusts))
{
__instance.ChangePsyfocus(pawn, target);
__instance.Animate(pawn, target);
__instance.PlaySexSound();
if (!__instance.isRape)
{
pawn.GainComfortFromCellIfPossible(false);
if (target is Pawn)
{
(target as Pawn).GainComfortFromCellIfPossible(false);
}
}
2021-04-21 05:24:56 +00:00
if(!__instance.isEndytophile)
{
SexUtility.DrawNude(pawn, false);
}
}
return false;
}
2020-05-29 20:12:35 +00:00
return true;
}
2020-04-09 00:43:01 +00:00
}
2020-07-11 16:25:13 +00:00
2020-04-09 00:43:01 +00:00
}