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
Binary file not shown.
|
@ -9,6 +9,7 @@ using Verse;
|
|||
namespace Rimworld_Animations {
|
||||
public abstract class BaseAnimationClip
|
||||
{
|
||||
public Dictionary<int, string> SoundEffects = new Dictionary<int, string>();
|
||||
public List<ThingDef> types; //types of participants
|
||||
public int duration;
|
||||
public abstract void buildSimpleCurves();
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace Rimworld_Animations {
|
|||
public List<PawnKeyframe> keyframes;
|
||||
public AltitudeLayer layer = AltitudeLayer.Pawn;
|
||||
|
||||
public Dictionary<int, string> SoundEffects = new Dictionary<int, string>();
|
||||
public Dictionary<int, bool> quiver = new Dictionary<int, bool>();
|
||||
public SimpleCurve GenitalAngle = new SimpleCurve();
|
||||
public SimpleCurve BodyAngle = new SimpleCurve();
|
||||
|
|
|
@ -3,14 +3,72 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
public class ThingAnimationClip : BaseAnimationClip
|
||||
{
|
||||
public List<ThingKeyframe> keyframes;
|
||||
|
||||
public override void buildSimpleCurves() {
|
||||
public SimpleCurve PositionX = new SimpleCurve();
|
||||
public SimpleCurve PositionZ = new SimpleCurve();
|
||||
public SimpleCurve Rotation = new SimpleCurve();
|
||||
|
||||
|
||||
public override void buildSimpleCurves() {
|
||||
int duration = 0;
|
||||
//getting the length of the whole clip
|
||||
foreach (ThingKeyframe frame in keyframes)
|
||||
{
|
||||
duration += frame.tickDuration;
|
||||
}
|
||||
|
||||
//guarantees loops don't get cut off mid-anim
|
||||
this.duration = duration;
|
||||
|
||||
int keyframePosition = 0;
|
||||
foreach (ThingKeyframe frame in keyframes)
|
||||
{
|
||||
|
||||
if (frame.atTick.HasValue)
|
||||
{
|
||||
if (frame.positionX.HasValue)
|
||||
PositionX.Add((float)frame.atTick / (float)duration, frame.positionX.Value, true);
|
||||
|
||||
if (frame.positionZ.HasValue)
|
||||
PositionZ.Add((float)frame.atTick / (float)duration, frame.positionZ.Value, true);
|
||||
|
||||
if (frame.rotation.HasValue)
|
||||
Rotation.Add((float)frame.atTick / (float)duration, frame.rotation.Value, true);
|
||||
|
||||
if (frame.soundEffect != null)
|
||||
{
|
||||
SoundEffects.Add((int)frame.atTick, frame.soundEffect);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (frame.positionX.HasValue)
|
||||
PositionX.Add((float)keyframePosition / (float)duration, frame.positionX.Value, true);
|
||||
|
||||
if (frame.positionZ.HasValue)
|
||||
PositionZ.Add((float)keyframePosition / (float)duration, frame.positionZ.Value, true);
|
||||
|
||||
if (frame.rotation.HasValue)
|
||||
Rotation.Add((float)keyframePosition / (float)duration, frame.rotation.Value, true);
|
||||
|
||||
if (frame.soundEffect != null)
|
||||
{
|
||||
SoundEffects.Add(keyframePosition, frame.soundEffect);
|
||||
}
|
||||
keyframePosition += frame.tickDuration;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Rimworld_Animations {
|
|||
public abstract class Keyframe
|
||||
{
|
||||
public int tickDuration = 1;
|
||||
|
||||
|
||||
public float? atTick;
|
||||
public string soundEffect;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,7 @@ namespace Rimworld_Animations {
|
|||
public int? bodyFacing;
|
||||
public int? headFacing;
|
||||
|
||||
public string soundEffect;
|
||||
public bool? quiver;
|
||||
|
||||
public float? atTick;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,5 +7,12 @@ using System.Threading.Tasks;
|
|||
namespace Rimworld_Animations {
|
||||
public class ThingKeyframe : Keyframe
|
||||
{
|
||||
|
||||
public float? positionX;
|
||||
public float? positionZ;
|
||||
public float? rotation;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,10 @@ using Verse;
|
|||
using RimWorld;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
class CompProperties_BodyAnimator : CompProperties
|
||||
public class CompProperties_BodyAnimator : CompProperties
|
||||
{
|
||||
public CompProperties_BodyAnimator() {
|
||||
public CompProperties_BodyAnimator()
|
||||
{
|
||||
|
||||
base.compClass = typeof(CompBodyAnimator);
|
||||
}
|
||||
|
|
|
@ -3,9 +3,15 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
class CompProperties_ThingAnimator
|
||||
public class CompProperties_ThingAnimator : CompProperties
|
||||
{
|
||||
|
||||
public CompProperties_ThingAnimator()
|
||||
{
|
||||
base.compClass = typeof(CompThingAnimator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,190 @@
|
|||
using System;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
class CompThingAnimator
|
||||
public class CompThingAnimator : ThingComp
|
||||
{
|
||||
Vector3 anchor;
|
||||
|
||||
Pawn pawn;
|
||||
|
||||
public bool isAnimating = false;
|
||||
|
||||
int animTicks = 0, stageTicks = 0, clipTicks = 0, curStage = 0;
|
||||
float rotation = 0;
|
||||
float clipPercent = 0;
|
||||
|
||||
public Vector3 deltaPos;
|
||||
|
||||
AnimationDef anim;
|
||||
private ThingAnimationClip clip => (ThingAnimationClip)stage.animationClips[1];
|
||||
private AnimationStage stage
|
||||
{
|
||||
get
|
||||
{
|
||||
return anim.animationStages[curStage];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void StartAnimation(AnimationDef anim, Pawn pawn)
|
||||
{
|
||||
isAnimating = true;
|
||||
|
||||
this.anim = anim;
|
||||
this.pawn = pawn;
|
||||
|
||||
animTicks = 0;
|
||||
stageTicks = 0;
|
||||
clipTicks = 0;
|
||||
|
||||
curStage = 0;
|
||||
clipPercent = 0;
|
||||
|
||||
tickAnim();
|
||||
|
||||
}
|
||||
|
||||
public void setAnchor(IntVec3 position)
|
||||
{
|
||||
anchor = position.ToVector3();
|
||||
}
|
||||
|
||||
public override void CompTick()
|
||||
{
|
||||
base.CompTick();
|
||||
|
||||
if(isAnimating)
|
||||
{
|
||||
if (pawn.Dead || pawn?.jobs?.curDriver == null || (pawn?.jobs?.curDriver != null && !(pawn?.jobs?.curDriver is rjw.JobDriver_Sex)))
|
||||
{
|
||||
isAnimating = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tickAnim();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void tickAnim()
|
||||
{
|
||||
if (!isAnimating) return;
|
||||
animTicks++;
|
||||
|
||||
if (animTicks < anim.animationTimeTicks)
|
||||
{
|
||||
tickStage();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LoopNeverending())
|
||||
{
|
||||
ResetOnLoop();
|
||||
}
|
||||
else
|
||||
{
|
||||
isAnimating = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void tickStage()
|
||||
{
|
||||
if (stage == null)
|
||||
{
|
||||
isAnimating = false;
|
||||
return;
|
||||
}
|
||||
|
||||
stageTicks++;
|
||||
|
||||
if (stageTicks >= stage.playTimeTicks)
|
||||
{
|
||||
|
||||
curStage++;
|
||||
|
||||
stageTicks = 0;
|
||||
clipTicks = 0;
|
||||
clipPercent = 0;
|
||||
}
|
||||
|
||||
if (curStage >= anim.animationStages.Count)
|
||||
{
|
||||
if (LoopNeverending())
|
||||
{
|
||||
ResetOnLoop();
|
||||
}
|
||||
else
|
||||
{
|
||||
isAnimating = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
tickClip();
|
||||
}
|
||||
}
|
||||
|
||||
public void tickClip()
|
||||
{
|
||||
clipTicks++;
|
||||
|
||||
if (clipPercent >= 1 && stage.isLooping)
|
||||
{
|
||||
clipTicks = 1;//warning: don't set to zero or else calculations go wrong
|
||||
}
|
||||
clipPercent = (float)clipTicks / (float)clip.duration;
|
||||
|
||||
calculateDrawValues();
|
||||
}
|
||||
|
||||
private void calculateDrawValues()
|
||||
{
|
||||
|
||||
//shift up and right 0.5f to align center
|
||||
deltaPos = new Vector3(clip.PositionX.Evaluate(clipPercent) + 0.5f/* todo * (mirror ? -1 : 1) */, AltitudeLayer.Item.AltitudeFor(), clip.PositionZ.Evaluate(clipPercent) + 0.5f);
|
||||
Log.Message("Clip percent: " + clipPercent + " deltaPos: " + deltaPos);
|
||||
rotation = clip.Rotation.Evaluate(clipPercent);
|
||||
}
|
||||
|
||||
public void AnimateThing(Thing thing)
|
||||
{
|
||||
thing.Graphic.Draw(deltaPos + anchor, Rot4.North, thing, rotation);
|
||||
}
|
||||
|
||||
public bool LoopNeverending()
|
||||
{
|
||||
if (pawn?.jobs?.curDriver != null &&
|
||||
(pawn.jobs.curDriver is JobDriver_Sex) && (pawn.jobs.curDriver as JobDriver_Sex).neverendingsex)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ResetOnLoop()
|
||||
{
|
||||
curStage = 1;
|
||||
animTicks = 0;
|
||||
stageTicks = 0;
|
||||
clipTicks = 0;
|
||||
|
||||
tickAnim();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
31
1.3/Source/Patches/RimworldPatches/HarmonyPatch_Thing.cs
Normal file
31
1.3/Source/Patches/RimworldPatches/HarmonyPatch_Thing.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
[HarmonyPatch(typeof(Thing), "DrawAt")]
|
||||
public static class HarmonyPatch_Thing
|
||||
{
|
||||
|
||||
public static bool Prefix(Thing __instance)
|
||||
{
|
||||
CompThingAnimator thingAnimator = __instance.TryGetComp<CompThingAnimator>();
|
||||
if (thingAnimator != null && thingAnimator.isAnimating)
|
||||
{
|
||||
thingAnimator.AnimateThing(__instance);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -13,6 +13,8 @@
|
|||
<li>/</li>
|
||||
<li>1.3</li>
|
||||
<li IfModActive="velc.HatsDisplaySelection">Patch_HatsDisplaySelection/1.2</li>
|
||||
<li IfModActive="c0ffee.SexToysMasturbation">Patch_SexToysMasturbation</li>
|
||||
<li IfModActive="c0ffee.SexToysMasturbation">Patch_SexToysMasturbation/1.3</li>
|
||||
</v1.3>
|
||||
|
||||
</loadFolders>
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,137 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
<Patch_SexToysMasturbation.SexToyAnimationDef>
|
||||
<defName>Masturbation_DildoVaginal</defName>
|
||||
<label>dildo masturbation</label>
|
||||
<requiredBodyPart>vagina</requiredBodyPart>
|
||||
<sounds>true</sounds>
|
||||
<sexTypes>
|
||||
<li>Masturbation</li>
|
||||
</sexTypes>
|
||||
<actors>
|
||||
<li>
|
||||
<defNames>
|
||||
<li>Human</li>
|
||||
</defNames>
|
||||
<isFucked>true</isFucked>
|
||||
</li>
|
||||
</actors>
|
||||
|
||||
<animationStages>
|
||||
<li>
|
||||
<stageName>Masturbating</stageName>
|
||||
<isLooping>true</isLooping>
|
||||
<playTimeTicks>800</playTimeTicks>
|
||||
<stageIndex>0</stageIndex>
|
||||
<animationClips>
|
||||
<li Class="Rimworld_Animations.PawnAnimationClip">
|
||||
<layer>LayingPawn</layer>
|
||||
<keyframes>
|
||||
<li>
|
||||
<!--out-->
|
||||
<tickDuration>40</tickDuration>
|
||||
<bodyAngle>73.01611</bodyAngle>
|
||||
<headAngle>40.0739746</headAngle>
|
||||
<genitalAngle>0</genitalAngle>
|
||||
<bodyOffsetZ>0.054543376</bodyOffsetZ>
|
||||
<bodyOffsetX>0.112624526</bodyOffsetX>
|
||||
<headBob>0</headBob>
|
||||
<bodyFacing>3</bodyFacing>
|
||||
<headFacing>3</headFacing>
|
||||
</li>
|
||||
<li>
|
||||
<!--almost out-->
|
||||
<soundEffect>Slimy</soundEffect>
|
||||
<tickDuration>30</tickDuration>
|
||||
<bodyAngle>76.4867554</bodyAngle>
|
||||
<headAngle>50.3887634</headAngle>
|
||||
<genitalAngle>0</genitalAngle>
|
||||
<bodyOffsetZ>0.0506898165</bodyOffsetZ>
|
||||
<bodyOffsetX>0.08564949</bodyOffsetX>
|
||||
<headBob>0</headBob>
|
||||
<bodyFacing>3</bodyFacing>
|
||||
<headFacing>3</headFacing>
|
||||
</li>
|
||||
<li>
|
||||
<!-- in -->
|
||||
<tickDuration>30</tickDuration>
|
||||
<bodyAngle>78.22131</bodyAngle>
|
||||
<headAngle>58.0072327</headAngle>
|
||||
<genitalAngle>0</genitalAngle>
|
||||
<bodyOffsetZ>0.039129138</bodyOffsetZ>
|
||||
<bodyOffsetX>0.07794231</bodyOffsetX>
|
||||
<headBob>0</headBob>
|
||||
<bodyFacing>3</bodyFacing>
|
||||
<headFacing>3</headFacing>
|
||||
</li>
|
||||
<li>
|
||||
<!--almost out-->
|
||||
<tickDuration>30</tickDuration>
|
||||
<bodyAngle>76.4867554</bodyAngle>
|
||||
<headAngle>50.3887634</headAngle>
|
||||
<genitalAngle>0</genitalAngle>
|
||||
<bodyOffsetZ>0.0506898165</bodyOffsetZ>
|
||||
<bodyOffsetX>0.08564949</bodyOffsetX>
|
||||
<headBob>0</headBob>
|
||||
<bodyFacing>3</bodyFacing>
|
||||
<headFacing>3</headFacing>
|
||||
</li>
|
||||
<li>
|
||||
<!--out-->
|
||||
<tickDuration>1</tickDuration>
|
||||
<bodyAngle>73.01611</bodyAngle>
|
||||
<headAngle>40.0739746</headAngle>
|
||||
<genitalAngle>0</genitalAngle>
|
||||
<bodyOffsetZ>0.054543376</bodyOffsetZ>
|
||||
<bodyOffsetX>0.112624526</bodyOffsetX>
|
||||
<headBob>0</headBob>
|
||||
<bodyFacing>3</bodyFacing>
|
||||
<headFacing>3</headFacing>
|
||||
</li>
|
||||
</keyframes>
|
||||
</li>
|
||||
<li Class="Rimworld_Animations.ThingAnimationClip">
|
||||
<keyframes>
|
||||
<li>
|
||||
<!--out-->
|
||||
<tickDuration>40</tickDuration>
|
||||
<positionX>-0.359264076</positionX>
|
||||
<positionZ>-0.00901746</positionZ>
|
||||
<rotation>114.011215</rotation>
|
||||
</li>
|
||||
<li>
|
||||
<!--almost out-->
|
||||
<tickDuration>30</tickDuration>
|
||||
<positionX>-0.2783391</positionX>
|
||||
<positionZ>-0.0514066666</positionZ>
|
||||
<rotation>81.16443</rotation>
|
||||
</li>
|
||||
<li>
|
||||
<!--in-->
|
||||
<tickDuration>30</tickDuration>
|
||||
<positionX>-0.1704393</positionX>
|
||||
<positionZ>-0.0668209046</positionZ>
|
||||
<rotation>72.8611145</rotation>
|
||||
</li>
|
||||
<li>
|
||||
<!--almost out-->
|
||||
<tickDuration>30</tickDuration>
|
||||
<positionX>-0.2783391</positionX>
|
||||
<positionZ>-0.0514066666</positionZ>
|
||||
<rotation>81.16443</rotation>
|
||||
</li>
|
||||
<li>
|
||||
<!--out-->
|
||||
<tickDuration>1</tickDuration>
|
||||
<positionX>-0.359264076</positionX>
|
||||
<positionZ>-0.00901746</positionZ>
|
||||
<rotation>114.011215</rotation>
|
||||
</li>
|
||||
</keyframes>
|
||||
</li>
|
||||
</animationClips>
|
||||
</li>
|
||||
|
||||
</animationStages>
|
||||
</Patch_SexToysMasturbation.SexToyAnimationDef>
|
||||
</Defs>
|
87
Patch_SexToysMasturbation/Patch_SexToysMasturbation.csproj
Normal file
87
Patch_SexToysMasturbation/Patch_SexToysMasturbation.csproj
Normal file
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{87763712-0536-4D5F-9EAA-520F15D4F84E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Patch_SexToysMasturbation</RootNamespace>
|
||||
<AssemblyName>Patch_SexToysMasturbation</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>1.3\Assemblies\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\..\..\..\workshop\content\294100\1127530465\1.3\Assemblies\0Harmony.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Rimworld-Animations, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\1.3\Assemblies\Rimworld-Animations.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="RJW">
|
||||
<HintPath>..\..\rjw\1.3\Assemblies\RJW.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="RJW-ToysAndMasturbation">
|
||||
<HintPath>..\..\rjw-toys-and-masturbation\Assemblies\RJW-ToysAndMasturbation.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Source\Defs\SexToyAnimationDef.cs" />
|
||||
<Compile Include="Source\Patches\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
|
||||
<Compile Include="Source\Harmony\Harmony_PatchAll.cs" />
|
||||
<Compile Include="Source\Utilities\AnimSexToyUtility.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="1.3\Assemblies\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="1.3\Defs\AnimationDefs\Animations_Dildo.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
36
Patch_SexToysMasturbation/Properties/AssemblyInfo.cs
Normal file
36
Patch_SexToysMasturbation/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Patch_SexToysMasturbation")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Patch_SexToysMasturbation")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("87763712-0536-4d5f-9eaa-520f15d4f84e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -65,6 +65,7 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="1.3\Source\Patches\RimworldPatches\HarmonyPatch_Thing.cs" />
|
||||
<Compile Include="1.3\Source\Utilities\PatchOperationAddOrReplace.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="1.3\Source\Actors\Actor.cs" />
|
||||
|
|
|
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rimworld-Animations", "Rimw
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Patch_HatsDisplaySelection", "Patch_HatsDisplaySelection\Patch_HatsDisplaySelection.csproj", "{BA766964-1716-422D-A09E-29426F8EB9D5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Patch_SexToysMasturbation", "Patch_SexToysMasturbation\Patch_SexToysMasturbation.csproj", "{87763712-0536-4D5F-9EAA-520F15D4F84E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -20,6 +22,10 @@ Global
|
|||
{BA766964-1716-422D-A09E-29426F8EB9D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BA766964-1716-422D-A09E-29426F8EB9D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BA766964-1716-422D-A09E-29426F8EB9D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{87763712-0536-4D5F-9EAA-520F15D4F84E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{87763712-0536-4D5F-9EAA-520F15D4F84E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{87763712-0536-4D5F-9EAA-520F15D4F84E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{87763712-0536-4D5F-9EAA-520F15D4F84E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
Loading…
Reference in a new issue