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

84 lines
2.3 KiB
C#
Raw Normal View History

using HarmonyLib;
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
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
[HarmonyPatch(typeof(JobDriver_Sex), "Orgasm")]
public class HarmonyPatch_Orgasm
{
public static bool Prefix(JobDriver_Sex __instance)
{
//todo: remove this code on next update
if (__instance.pawn.jobs.curDriver is JobDriver_SexBaseRecieverLoved ||
__instance.pawn.jobs.curDriver is JobDriver_SexBaseRecieverRaped) return true;
2020-04-26 15:03:57 +00:00
if (__instance.sex_ticks > __instance.orgasmstick)
{
return false;
}
__instance.orgasms++;
__instance.PlayCumSound();
__instance.PlayOrgasmVoice();
__instance.CalculateSatisfactionPerTick();
2020-04-26 15:03:57 +00:00
if (__instance.pawn?.jobs?.curDriver is JobDriver_SexBaseInitiator)
{
SexUtility.SatisfyPersonal(__instance.pawn, __instance.Partner, __instance.sexType, __instance.isRape, true, __instance.satisfaction);
2020-04-09 00:43:01 +00:00
}
else
{
if (__instance.pawn?.jobs?.curDriver is JobDriver_SexBaseReciever)
{
Pawn pawn = __instance.pawn;
Pawn_JobTracker jobs3 = __instance.pawn.jobs;
SexUtility.SatisfyPersonal(pawn, (__instance.pawn.jobs.curDriver as JobDriver_SexBaseReciever).parteners.FirstOrFallback(null), __instance.sexType, false, false, __instance.satisfaction);
2020-04-26 15:03:57 +00:00
}
}
Log.Message(xxx.get_pawnname(__instance.pawn) + " Orgasmed", false);
__instance.sex_ticks = __instance.Roll_Orgasm_Duration_Reset();
if (__instance.neverendingsex)
{
__instance.ticks_left = __instance.duration;
2020-04-09 00:43:01 +00:00
}
return false;
}
}
2020-04-09 00:43:01 +00:00
}