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
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<Manifest>
|
<Manifest>
|
||||||
<identifier>Rimworld-Animations</identifier>
|
<identifier>Rimworld-Animations</identifier>
|
||||||
<version>1.0.16</version>
|
<version>1.1.0</version>
|
||||||
</Manifest>
|
</Manifest>
|
|
@ -45,7 +45,7 @@
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RJW">
|
<Reference Include="RJW">
|
||||||
<HintPath>..\rjw-master\1.2\Assemblies\RJW.dll</HintPath>
|
<HintPath>..\RJW\1.2\Assemblies\RJW.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
@ -105,6 +105,7 @@
|
||||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
|
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
|
||||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_JoinInBedGiveJob.cs" />
|
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_JoinInBedGiveJob.cs" />
|
||||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_PlayAnimJoinInBedRMB.cs" />
|
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_PlayAnimJoinInBedRMB.cs" />
|
||||||
|
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_PlaySexSounds.cs" />
|
||||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_SexTick.cs" />
|
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_SexTick.cs" />
|
||||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_WorkGiverSex.cs" />
|
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_WorkGiverSex.cs" />
|
||||||
<Compile Include="Source\Settings\AnimationSettings.cs" />
|
<Compile Include="Source\Settings\AnimationSettings.cs" />
|
||||||
|
|
|
@ -159,9 +159,8 @@ namespace Rimworld_Animations {
|
||||||
//tick once for initialization
|
//tick once for initialization
|
||||||
tickAnim();
|
tickAnim();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CompTick() {
|
public override void CompTick() {
|
||||||
|
|
||||||
base.CompTick();
|
base.CompTick();
|
||||||
|
@ -209,8 +208,16 @@ namespace Rimworld_Animations {
|
||||||
tickStage();
|
tickStage();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if(LoopNeverending())
|
||||||
|
{
|
||||||
|
ResetOnLoop();
|
||||||
|
} else
|
||||||
|
{
|
||||||
isAnimating = false;
|
isAnimating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tickStage()
|
public void tickStage()
|
||||||
|
@ -227,8 +234,15 @@ namespace Rimworld_Animations {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(curStage >= anim.animationStages.Count) {
|
if(curStage >= anim.animationStages.Count) {
|
||||||
|
if (LoopNeverending())
|
||||||
|
{
|
||||||
|
ResetOnLoop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
isAnimating = false;
|
isAnimating = false;
|
||||||
pawn.jobs.curDriver.ReadyForNextToil();
|
pawn.jobs.curDriver.ReadyForNextToil();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
tickClip();
|
tickClip();
|
||||||
|
@ -444,5 +458,26 @@ namespace Rimworld_Animations {
|
||||||
tickAnim();
|
tickAnim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool LoopNeverending()
|
||||||
|
{
|
||||||
|
if(pawn?.jobs?.curDriver != null &&
|
||||||
|
(pawn.jobs.curDriver is JobDriver_Sex) && (pawn.jobs.curDriver as JobDriver_Sex).neverendingsex ||
|
||||||
|
(pawn.jobs.curDriver is JobDriver_SexBaseReciever) && (pawn.jobs.curDriver as JobDriver_Sex).Partner?.jobs?.curDriver != null && ((pawn.jobs.curDriver as JobDriver_Sex).Partner.jobs.curDriver as JobDriver_Sex).neverendingsex)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetOnLoop()
|
||||||
|
{
|
||||||
|
curStage = 1;
|
||||||
|
animTicks = 0;
|
||||||
|
stageTicks = 0;
|
||||||
|
clipTicks = 0;
|
||||||
|
|
||||||
|
tickAnim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,6 @@ namespace Rimworld_Animations {
|
||||||
pawn.TryGetComp<CompBodyAnimator>().isAnimating = false;
|
pawn.TryGetComp<CompBodyAnimator>().isAnimating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ticks_left--;
|
|
||||||
if(Gen.IsHashIntervalTick(pawn, ticks_between_hearts)) {
|
if(Gen.IsHashIntervalTick(pawn, ticks_between_hearts)) {
|
||||||
MoteMaker.ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
|
MoteMaker.ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ namespace Rimworld_Animations {
|
||||||
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
|
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
|
||||||
static class HarmonyPatch_JobDriver_SexBaseInitiator_Start {
|
static class HarmonyPatch_JobDriver_SexBaseInitiator_Start {
|
||||||
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
|
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
These particular jobs need special code
|
These particular jobs need special code
|
||||||
don't play anim for now
|
don't play anim for now
|
||||||
|
@ -52,16 +51,31 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
bool quickie = (__instance is JobDriver_SexQuick) && AnimationSettings.fastAnimForQuickie;
|
bool quickie = (__instance is JobDriver_SexQuick) && AnimationSettings.fastAnimForQuickie;
|
||||||
|
|
||||||
|
int preAnimDuration = __instance.duration;
|
||||||
|
int AnimationTimeTicks = 0;
|
||||||
|
|
||||||
|
|
||||||
if (bed != null) {
|
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 {
|
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)) {
|
if(pawn == null || !(pawn.jobs?.curDriver is JobDriver_SexBaseReciever)) {
|
||||||
Log.Error("Error: Tried to reroll animations when pawn isn't sexing");
|
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;
|
bool mirror = GenTicks.TicksGame % 2 == 0;
|
||||||
|
|
||||||
Log.Message("Now playing " + anim.defName + (AnimationSettings.debugMode && mirror ? " mirrored" : ""));
|
|
||||||
|
|
||||||
IntVec3 pos = pawn.Position;
|
IntVec3 pos = pawn.Position;
|
||||||
|
|
||||||
if(pawnsToAnimate.Count > anim.actors.Count)
|
if(pawnsToAnimate.Count > anim.actors.Count)
|
||||||
|
@ -112,9 +124,14 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
bool shiver = pawnsToAnimate[i].jobs.curDriver is JobDriver_SexBaseRecieverRaped;
|
bool shiver = pawnsToAnimate[i].jobs.curDriver is JobDriver_SexBaseRecieverRaped;
|
||||||
pawnsToAnimate[i].TryGetComp<CompBodyAnimator>().StartAnimation(anim, pawnsToAnimate, i, mirror, shiver, fastAnimForQuickie);
|
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).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;
|
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).duration = anim.animationTimeTicks;
|
||||||
|
|
||||||
|
|
||||||
|
AnimationTimeTicks = anim.animationTimeTicks;
|
||||||
|
|
||||||
if(!AnimationSettings.hearts) {
|
if(!AnimationSettings.hearts) {
|
||||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticks_between_hearts = Int32.MaxValue;
|
(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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using HarmonyLib;
|
|
||||||
using RimWorld;
|
|
||||||
using Verse;
|
using Verse;
|
||||||
using rjw;
|
using Verse.AI;
|
||||||
using Verse.Sound;
|
|
||||||
|
|
||||||
namespace Rimworld_Animations {
|
|
||||||
|
|
||||||
|
namespace Rimworld_Animations
|
||||||
|
{
|
||||||
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
|
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
|
||||||
public static class HarmonyPatch_SexTick {
|
public class HarmonyPatch_SexTick
|
||||||
|
{
|
||||||
|
public static bool Prefix(JobDriver_Sex __instance, Pawn pawn, Thing target)
|
||||||
|
{
|
||||||
|
|
||||||
public static bool Prefix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target, ref bool pawnnude, ref bool partnernude) {
|
Log.Message(pawn.Name + " ticks left: " + __instance.ticks_left);
|
||||||
|
Log.Message(pawn.Name + " sex ticks: " + __instance.sex_ticks);
|
||||||
|
|
||||||
Pawn pawn2 = target as Pawn;
|
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))
|
||||||
|
{
|
||||||
|
|
||||||
|
__instance.ticks_left--;
|
||||||
|
__instance.sex_ticks--;
|
||||||
|
__instance.Orgasm();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (pawn == null || pawn2 == null) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
[HarmonyPatch(typeof(JobDriver_Sex), "Orgasm")]
|
||||||
pawn.GainComfortFromCellIfPossible();
|
public class HarmonyPatch_Orgasm
|
||||||
pawn2?.GainComfortFromCellIfPossible();
|
{
|
||||||
|
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 (__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")) {
|
else
|
||||||
if (pawnnude) {
|
{
|
||||||
SexUtility.DrawNude(pawn);
|
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);
|
||||||
}
|
}
|
||||||
if (pawn2 != null && partnernude) {
|
|
||||||
SexUtility.DrawNude(pawn2);
|
|
||||||
}
|
}
|
||||||
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue