mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
Update for RJW 4.6.7.2:
accounts for orgasm ticker changes orgasm ticker count accounts for animation length vs standard jobdriver length difference Accounts for neverending loop settings in RJW todo: remove unnecessary harmonypatch in sextick next RJW update
This commit is contained in:
parent
e5ce0db627
commit
6550627272
8 changed files with 161 additions and 51 deletions
|
@ -13,7 +13,6 @@ namespace Rimworld_Animations {
|
|||
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
|
||||
static class HarmonyPatch_JobDriver_SexBaseInitiator_Start {
|
||||
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
|
||||
|
||||
/*
|
||||
These particular jobs need special code
|
||||
don't play anim for now
|
||||
|
@ -52,16 +51,31 @@ namespace Rimworld_Animations {
|
|||
|
||||
bool quickie = (__instance is JobDriver_SexQuick) && AnimationSettings.fastAnimForQuickie;
|
||||
|
||||
int preAnimDuration = __instance.duration;
|
||||
int AnimationTimeTicks = 0;
|
||||
|
||||
|
||||
if (bed != null) {
|
||||
RerollAnimations(Target, __instance.duration, bed as Thing, __instance.sexType, quickie, sexProps: __instance.Sexprops);
|
||||
}
|
||||
RerollAnimations(Target, out AnimationTimeTicks, bed as Thing, __instance.sexType, quickie, sexProps: __instance.Sexprops);
|
||||
}
|
||||
else {
|
||||
RerollAnimations(Target, __instance.duration, sexType: __instance.sexType, fastAnimForQuickie: quickie, sexProps: __instance.Sexprops);
|
||||
RerollAnimations(Target, out AnimationTimeTicks, sexType: __instance.sexType, fastAnimForQuickie: quickie, sexProps: __instance.Sexprops);
|
||||
}
|
||||
|
||||
|
||||
//Modify Orgasm ticks to only orgasm as many times as RJW stock orgasm allows
|
||||
if(AnimationTimeTicks != 0)
|
||||
{
|
||||
__instance.orgasmstick = preAnimDuration * __instance.orgasmstick / AnimationTimeTicks;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void RerollAnimations(Pawn pawn, int duration, Thing bed = null, xxx.rjwSextype sexType = xxx.rjwSextype.None, bool fastAnimForQuickie = false, rjw.SexProps sexProps = null) {
|
||||
public static void RerollAnimations(Pawn pawn, out int AnimationTimeTicks, Thing bed = null, xxx.rjwSextype sexType = xxx.rjwSextype.None, bool fastAnimForQuickie = false, rjw.SexProps sexProps = null) {
|
||||
|
||||
AnimationTimeTicks = 0;
|
||||
|
||||
if(pawn == null || !(pawn.jobs?.curDriver is JobDriver_SexBaseReciever)) {
|
||||
Log.Error("Error: Tried to reroll animations when pawn isn't sexing");
|
||||
|
@ -88,8 +102,6 @@ namespace Rimworld_Animations {
|
|||
|
||||
bool mirror = GenTicks.TicksGame % 2 == 0;
|
||||
|
||||
Log.Message("Now playing " + anim.defName + (AnimationSettings.debugMode && mirror ? " mirrored" : ""));
|
||||
|
||||
IntVec3 pos = pawn.Position;
|
||||
|
||||
if(pawnsToAnimate.Count > anim.actors.Count)
|
||||
|
@ -112,9 +124,14 @@ namespace Rimworld_Animations {
|
|||
|
||||
bool shiver = pawnsToAnimate[i].jobs.curDriver is JobDriver_SexBaseRecieverRaped;
|
||||
pawnsToAnimate[i].TryGetComp<CompBodyAnimator>().StartAnimation(anim, pawnsToAnimate, i, mirror, shiver, fastAnimForQuickie);
|
||||
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticks_left = anim.animationTimeTicks;
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticksLeftThisToil = anim.animationTimeTicks;
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).sex_ticks = anim.animationTimeTicks;
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).duration = anim.animationTimeTicks;
|
||||
|
||||
|
||||
AnimationTimeTicks = anim.animationTimeTicks;
|
||||
|
||||
if(!AnimationSettings.hearts) {
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticks_between_hearts = Int32.MaxValue;
|
||||
}
|
||||
|
|
25
Source/Patches/rjwPatches/HarmonyPatch_PlaySexSounds.cs
Normal file
25
Source/Patches/rjwPatches/HarmonyPatch_PlaySexSounds.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
[HarmonyPatch(typeof(JobDriver_Sex), "PlaySexSound")]
|
||||
class HarmonyPatch_PlaySexSounds
|
||||
{
|
||||
public static bool Prefix(JobDriver_Sex __instance)
|
||||
{
|
||||
if (__instance.pawn.TryGetComp<CompBodyAnimator>().isAnimating)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,53 +1,86 @@
|
|||
using System;
|
||||
using HarmonyLib;
|
||||
using rjw;
|
||||
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;
|
||||
using Verse.AI;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
|
||||
public class HarmonyPatch_SexTick
|
||||
{
|
||||
public static bool Prefix(JobDriver_Sex __instance, Pawn pawn, Thing target)
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
|
||||
public static class HarmonyPatch_SexTick {
|
||||
Log.Message(pawn.Name + " ticks left: " + __instance.ticks_left);
|
||||
Log.Message(pawn.Name + " sex ticks: " + __instance.sex_ticks);
|
||||
|
||||
public static bool Prefix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target, ref bool pawnnude, ref bool partnernude) {
|
||||
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))
|
||||
{
|
||||
|
||||
Pawn pawn2 = target as Pawn;
|
||||
__instance.ticks_left--;
|
||||
__instance.sex_ticks--;
|
||||
__instance.Orgasm();
|
||||
|
||||
if (pawn == null || pawn2 == null) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[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;
|
||||
|
||||
if (__instance.sex_ticks > __instance.orgasmstick)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
__instance.orgasms++;
|
||||
__instance.PlayCumSound();
|
||||
__instance.PlayOrgasmVoice();
|
||||
__instance.CalculateSatisfactionPerTick();
|
||||
|
||||
|
||||
if (pawn.IsHashIntervalTick(__instance.ticks_between_thrusts)) {
|
||||
|
||||
__instance.ChangePsyfocus(pawn, pawn2);
|
||||
|
||||
__instance.Animate(pawn, pawn2);
|
||||
|
||||
if (!AnimationSettings.soundOverride || pawn.TryGetComp<CompBodyAnimator>() == null || !pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
__instance.PlaySexSound();
|
||||
}
|
||||
|
||||
if (!__instance.isRape) {
|
||||
pawn.GainComfortFromCellIfPossible();
|
||||
pawn2?.GainComfortFromCellIfPossible();
|
||||
}
|
||||
if (__instance.pawn?.jobs?.curDriver is JobDriver_SexBaseInitiator)
|
||||
{
|
||||
SexUtility.SatisfyPersonal(__instance.pawn, __instance.Partner, __instance.sexType, __instance.isRape, true, __instance.satisfaction);
|
||||
}
|
||||
if (!xxx.has_quirk(pawn, "Endytophile")) {
|
||||
if (pawnnude) {
|
||||
SexUtility.DrawNude(pawn);
|
||||
}
|
||||
if (pawn2 != null && partnernude) {
|
||||
SexUtility.DrawNude(pawn2);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue