updates for 1.3

This commit is contained in:
c0ffee 2022-01-23 15:29:13 -08:00
parent da8939c4b8
commit 00e8d5cf4e
8 changed files with 58 additions and 19 deletions

View file

@ -5,8 +5,7 @@
<packageId>c0ffee.SexToysMasturbation</packageId>
<author>c0ffee</author>
<supportedVersions>
<li>1.1</li>
<li>1.2</li>
<li>1.3</li>
</supportedVersions>
<modDependencies>

View file

@ -41,7 +41,7 @@
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\RJW\1.1\Assemblies\RJW.dll</HintPath>
<HintPath>..\rjw\1.3\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
@ -66,6 +66,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Source\JobDrivers\JobDriver_MasturbateWithToy.cs" />
<Compile Include="Source\JobGivers\JobGiver_MasturbateWithToy.cs" />
<Compile Include="Source\Patches\HarmonyPatch_JobDriver_Masturbate.cs" />
<Compile Include="Source\ThingComps\CompProperties_SexToy.cs" />
<Compile Include="Source\ThingComps\CompSexToy.cs" />
<Compile Include="Source\Utils\SexToyUtility.cs" />

View file

@ -9,16 +9,18 @@ using rjw;
using Verse.AI;
namespace RJW_ToysAndMasturbation {
class JobDriver_MasturbateWithToy : JobDriver_SexBaseInitiator {
public class JobDriver_MasturbateWithToy : JobDriver_SexBaseInitiator {
public IntVec3 cell => (IntVec3)job.GetTarget(iCell);
public Thing dildo => (Thing)job.GetTarget(TargetIndex.A);
public override bool TryMakePreToilReservations(bool errorOnFailed) {
return ReservationUtility.Reserve(pawn, job.targetA, job, stackCount: 1, errorOnFailed: false);
}
public new void setup_ticks() {
base.setup_ticks();
duration = (int)(xxx.is_frustrated(base.pawn) ? (2500f * Rand.Range(0.2f, 0.7f)) : (2500f * Rand.Range(0.2f, 0.4f)));
duration = ticks_left = (int)(xxx.is_frustrated(base.pawn) ? (2500f * Rand.Range(0.2f, 0.7f)) : (2500f * Rand.Range(0.2f, 0.4f)));
}
protected override IEnumerable<Toil> MakeNewToils() {
@ -31,12 +33,6 @@ namespace RJW_ToysAndMasturbation {
yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A);
yield return Toils_Haul.StartCarryThing(TargetIndex.A);
if (!SexToyUtility.isRJWAnimationsLoaded || true /*True for now*/) {
//place down if anims isn't loaded
yield return Toils_Haul.CarryHauledThingToCell(TargetIndex.C);
yield return Toils_Haul.PlaceHauledThingInCell(TargetIndex.C, Toils_Goto.GotoCell(TargetIndex.C, PathEndMode.OnCell), storageMode: false);
}
yield return Toils_Goto.GotoCell(TargetIndex.C, PathEndMode.OnCell);
@ -46,20 +42,19 @@ namespace RJW_ToysAndMasturbation {
masturbationToil.defaultCompleteMode = ToilCompleteMode.Never;
masturbationToil.initAction = delegate { Start(); };
masturbationToil.tickAction = delegate {
duration--;
if (Gen.IsHashIntervalTick(pawn, ticks_between_hearts)) {
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
ThrowMetaIconF(pawn.Position, this.pawn.Map, FleckDefOf.Heart);
}
SexTick(pawn, null);
SexUtility.reduce_rest(pawn);
if (duration <= 0) ReadyForNextToil();
if (ticks_left <= 0) ReadyForNextToil();
};
masturbationToil.AddFinishAction(delegate { End(); });
yield return masturbationToil;
Toil AfterToil = new Toil();
AfterToil.initAction = delegate {
SexUtility.Aftersex(pawn);
SexUtility.Aftersex(Sexprops);
if(SexUtility.ConsiderCleaning(pawn)) {
LocalTargetInfo filth = GridsUtility.GetFirstThing<Filth>(pawn.PositionHeld, pawn.Map);
Job cleanup = JobMaker.MakeJob(JobDefOf.Clean);

View file

@ -11,7 +11,7 @@ using Verse.AI;
namespace RJW_ToysAndMasturbation {
class JobGiver_MasturbateWithToy : ThinkNode_JobGiver {
public static IntVec3 FapLocation(Pawn p) => (new JobGiver_Masturbate()).FindFapLocation(p);
public static IntVec3 FapLocation(Pawn p) => CasualSex_Helper.FindSexLocation(p);
protected override Job TryGiveJob(Pawn pawn) {

View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using rjw;
using Verse;
using HarmonyLib;
namespace RJW_ToysAndMasturbation
{
//Nerfs masturbate satisfaction
[HarmonyPatch(typeof(JobDriver_Masturbate), "CalculateSatisfactionPerTick")]
public class HarmonyPatch_JobDriver_Masturbate
{
public static void Postfix(ref JobDriver_Masturbate __instance)
{
Log.Message("regular masturbation");
__instance.satisfaction *= 0.6f;
}
}
[HarmonyPatch(typeof(JobDriver_MasturbateWithToy), "CalculateSatisfactionPerTick")]
public class HarmonyPatch_JobDriver_MasturbateWithToy
{
public static void Postfix(ref JobDriver_MasturbateWithToy __instance)
{
Log.Message("Sextoy satisfaction modifier: " + __instance.dildo.TryGetComp<CompSexToy>().Props.satisfactionModifier);
__instance.satisfaction *= 0.6f * __instance.dildo.TryGetComp<CompSexToy>().Props.satisfactionModifier;
}
}
}

View file

@ -10,6 +10,7 @@ namespace RJW_ToysAndMasturbation {
public class CompProperties_SexToy : CompProperties {
public Gender primaryGender = Gender.Female;
public float satisfactionModifier = 1.5f;
public CompProperties_SexToy() {
compClass = typeof(CompSexToy);
}

View file

@ -11,7 +11,7 @@ using rjw;
namespace RJW_ToysAndMasturbation {
public class CompSexToy : ThingComp {
public static IntVec3 FapLocation(Pawn p) => (new JobGiver_Masturbate()).FindFapLocation(p);
public static IntVec3 FapLocation(Pawn p) => CasualSex_Helper.FindSexLocation(p);
public CompProperties_SexToy Props => (CompProperties_SexToy)props;
@ -34,8 +34,8 @@ namespace RJW_ToysAndMasturbation {
yield return new FloatMenuOption(FloatMenuOptionLabel(pawn), delegate {
if (RJWPreferenceSettings.FapInBed && pawn.jobs.curDriver is JobDriver_LayDown) {
Building_Bed bed = ((JobDriver_LayDown)pawn.jobs.curDriver).Bed;
if (RJWPreferenceSettings.FapInBed && pawn.jobs.curDriver is JobDriver_LayDown down) {
Building_Bed bed = down.Bed;
if (bed != null) {
Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, parent, bed, bed.Position);
j.count = 1;