mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
added simple for dildo
This commit is contained in:
parent
52c8afbe1b
commit
015a64928a
22 changed files with 712 additions and 11 deletions
16
Patch_SexToysMasturbation/Source/Defs/SexToyAnimationDef.cs
Normal file
16
Patch_SexToysMasturbation/Source/Defs/SexToyAnimationDef.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using Rimworld_Animations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Patch_SexToysMasturbation
|
||||
{
|
||||
public class SexToyAnimationDef : AnimationDef
|
||||
{
|
||||
|
||||
public String requiredBodyPart = null;
|
||||
|
||||
}
|
||||
}
|
23
Patch_SexToysMasturbation/Source/Harmony/Harmony_PatchAll.cs
Normal file
23
Patch_SexToysMasturbation/Source/Harmony/Harmony_PatchAll.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Patch_SexToysMasturbation
|
||||
{
|
||||
|
||||
[StaticConstructorOnStartup]
|
||||
public static class Harmony_PatchAll {
|
||||
|
||||
static Harmony_PatchAll() {
|
||||
|
||||
Harmony val = new Harmony("animtoyspatch");
|
||||
val.PatchAll(Assembly.GetExecutingAssembly());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
using HarmonyLib;
|
||||
using Rimworld_Animations;
|
||||
using rjw;
|
||||
using RJW_ToysAndMasturbation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Patch_SexToysMasturbation
|
||||
{
|
||||
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
|
||||
public class HarmonyPatch_JobDriver_SexBaseInitiator
|
||||
{
|
||||
|
||||
public static void Postfix(ref JobDriver_SexBaseInitiator __instance)
|
||||
{
|
||||
|
||||
if(__instance is JobDriver_MasturbateWithToy masturbateJobDriver)
|
||||
{
|
||||
Log.Message("Rerolling animations...");
|
||||
Pawn pawn = masturbateJobDriver.pawn;
|
||||
Thing sexToy = masturbateJobDriver.dildo;
|
||||
|
||||
RerollAnimationsForSexToy(pawn, sexToy);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void RerollAnimationsForSexToy(Pawn pawn, Thing thing)
|
||||
{
|
||||
CompSexToy sextoy = thing.TryGetComp<CompSexToy>();
|
||||
|
||||
SexToyAnimationDef anim = AnimSexToyUtility.tryFindAnimation(sextoy, pawn);
|
||||
|
||||
|
||||
|
||||
if (anim != null)
|
||||
{
|
||||
Log.Message("Playing anim " + anim.defName);
|
||||
|
||||
pawn.TryGetComp<CompBodyAnimator>().setAnchor(pawn.Position);
|
||||
thing.TryGetComp<CompThingAnimator>().setAnchor(pawn.Position);
|
||||
|
||||
pawn.TryGetComp<CompBodyAnimator>().StartAnimation(anim, new List<Pawn> { pawn }, 0);
|
||||
thing.TryGetComp<CompThingAnimator>().StartAnimation(anim, pawn);
|
||||
|
||||
(pawn.jobs.curDriver as JobDriver_Sex).ticks_left = anim.animationTimeTicks;
|
||||
(pawn.jobs.curDriver as JobDriver_Sex).sex_ticks = anim.animationTimeTicks;
|
||||
(pawn.jobs.curDriver as JobDriver_Sex).duration = anim.animationTimeTicks;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Message("No animation found");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
using rjw;
|
||||
using RJW_ToysAndMasturbation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Patch_SexToysMasturbation
|
||||
{
|
||||
public class AnimSexToyUtility
|
||||
{
|
||||
|
||||
public static SexToyAnimationDef tryFindAnimation(CompSexToy sexToy, Pawn pawn)
|
||||
{
|
||||
|
||||
IEnumerable<SexToyAnimationDef> options = DefDatabase<SexToyAnimationDef>.AllDefs.Where((SexToyAnimationDef x) =>
|
||||
{
|
||||
|
||||
if(!sexToy.Props.requiredBodyParts.Contains(x.requiredBodyPart))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(x.requiredBodyPart == "vagina" && !Genital_Helper.has_vagina(pawn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
if(options != null && options.Any())
|
||||
{
|
||||
return options.RandomElement();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue