diff --git a/Assemblies/RJW-ToysAndMasturbation.dll b/Assemblies/RJW-ToysAndMasturbation.dll
index 17a7d54..042aabd 100644
Binary files a/Assemblies/RJW-ToysAndMasturbation.dll and b/Assemblies/RJW-ToysAndMasturbation.dll differ
diff --git a/Defs/ThinkTreeDefs/ThinkTrees_Masturbate.xml b/Defs/ThinkTreeDefs/ThinkTrees_Masturbate.xml
new file mode 100644
index 0000000..2734935
--- /dev/null
+++ b/Defs/ThinkTreeDefs/ThinkTrees_Masturbate.xml
@@ -0,0 +1,21 @@
+
+
+
+ FapWithToyTree
+ Humanlike_PostMentalState
+ 12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Defs/ThoughtDefs/Thoughts_SexToy.xml b/Defs/ThoughtDefs/Thoughts_SexToy.xml
new file mode 100644
index 0000000..4e1c739
--- /dev/null
+++ b/Defs/ThoughtDefs/Thoughts_SexToy.xml
@@ -0,0 +1,17 @@
+
+
+
+ UsedSexToy
+ Thought_Memory
+ 1.0
+ 3
+ 0.2
+
+
+
+ A step above just using your hand.
+ 4
+
+
+
+
\ No newline at end of file
diff --git a/RJW-ToysAndMasturbation.csproj b/RJW-ToysAndMasturbation.csproj
index 9345f24..be0acd2 100644
--- a/RJW-ToysAndMasturbation.csproj
+++ b/RJW-ToysAndMasturbation.csproj
@@ -72,6 +72,8 @@
+
+
diff --git a/Source/DefOfs/MasturbateToyDefOf.cs b/Source/DefOfs/MasturbateToyDefOf.cs
index dfca664..6edcdaf 100644
--- a/Source/DefOfs/MasturbateToyDefOf.cs
+++ b/Source/DefOfs/MasturbateToyDefOf.cs
@@ -13,6 +13,8 @@ namespace RJW_ToysAndMasturbation {
public static JobDef MasturbateWithToy;
+ public static ThoughtDef UsedSexToy;
+
static MasturbateToyDefOf() {
DefOfHelper.EnsureInitializedInCtor(typeof(JobDefOf));
}
diff --git a/Source/JobDrivers/JobDriver_MasturbateWithToy.cs b/Source/JobDrivers/JobDriver_MasturbateWithToy.cs
index 66d2523..b09e854 100644
--- a/Source/JobDrivers/JobDriver_MasturbateWithToy.cs
+++ b/Source/JobDrivers/JobDriver_MasturbateWithToy.cs
@@ -32,7 +32,7 @@ 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, anims come later; disable once created animations*/) {
+ 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);
@@ -66,6 +66,8 @@ namespace RJW_ToysAndMasturbation {
cleanup.AddQueuedTarget(TargetIndex.A, filth);
pawn.jobs.jobQueue.EnqueueFirst(cleanup);
}
+ //bonus mood
+ pawn.needs?.mood?.thoughts?.memories?.TryGainMemory(MasturbateToyDefOf.UsedSexToy);
};
yield return AfterToil;
diff --git a/Source/JobGivers/JobGiver_MasturbateWithToy.cs b/Source/JobGivers/JobGiver_MasturbateWithToy.cs
index 57a6856..4ce85f4 100644
--- a/Source/JobGivers/JobGiver_MasturbateWithToy.cs
+++ b/Source/JobGivers/JobGiver_MasturbateWithToy.cs
@@ -21,20 +21,59 @@ namespace RJW_ToysAndMasturbation {
if (!xxx.can_be_fucked(pawn) && !xxx.can_fuck(pawn)) {
return null;
}
- if ((SexUtility.ReadyForLovin(pawn) && (!xxx.is_whore(pawn) || pawn.IsPrisoner || xxx.is_slave(pawn))) || xxx.is_frustrated(pawn)) {
- if (RJWPreferenceSettings.FapInBed && pawn.jobs.curDriver is JobDriver_LayDown) {
- Building_Bed bed = ((JobDriver_LayDown)pawn.jobs.curDriver).Bed;
- if (bed != null) {
- return JobMaker.MakeJob(xxx.Masturbate, null, bed, bed.Position);
+
+ if(findSexToyOnMap(pawn, out Thing sexToy)) {
+ if ((SexUtility.ReadyForLovin(pawn) && (!xxx.is_whore(pawn) || pawn.IsPrisoner || xxx.is_slave(pawn))) || xxx.is_frustrated(pawn)) {
+ if (RJWPreferenceSettings.FapInBed && pawn.jobs.curDriver is JobDriver_LayDown) {
+ Building_Bed bed = ((JobDriver_LayDown)pawn.jobs.curDriver).Bed;
+ if (bed != null) {
+
+ Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, sexToy, bed, bed.Position);
+ j.count = 1;
+ return j;
+
+ }
}
+ else if (RJWPreferenceSettings.FapEverywhere && (xxx.is_frustrated(pawn) || xxx.has_quirk(pawn, "Exhibitionist"))) {
+ Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, sexToy, null, FapLocation(pawn));
+ j.count = 1;
+ return j;
+ }
+
}
- else if (RJWPreferenceSettings.FapEverywhere && (xxx.is_frustrated(pawn) || xxx.has_quirk(pawn, "Exhibitionist"))) {
- return JobMaker.MakeJob(xxx.Masturbate, null, null, FapLocation(pawn));
- }
+
+ return null;
}
+
return null;
}
+ public static bool findSexToyOnMap(Pawn p, out Thing sexToy) {
+
+ Predicate validator = delegate (Thing t) {
+ if(t.TryGetComp() == null) {
+ return false;
+ }
+ //homo check
+ if (t.TryGetComp().Props.primaryGender == p.gender ||
+ (t.TryGetComp().Props.primaryGender == Gender.Male && xxx.can_fuck(p) && (RJWPreferenceSettings.FeMalesex == RJWPreferenceSettings.AllowedSex.All || RJWPreferenceSettings.FeMalesex == RJWPreferenceSettings.AllowedSex.Homo)) ||
+ (t.TryGetComp().Props.primaryGender == Gender.Female && xxx.can_be_fucked(p) && (RJWPreferenceSettings.Malesex == RJWPreferenceSettings.AllowedSex.All || RJWPreferenceSettings.Malesex == RJWPreferenceSettings.AllowedSex.Homo)))
+ {
+ return true;
+ }
+
+ return false;
+ };
+
+
+ sexToy = GenClosest.ClosestThingReachable(p.Position, p.Map, ThingRequest.ForGroup(ThingRequestGroup.HaulableAlways), PathEndMode.OnCell, TraverseParms.For(p), validator: validator, maxDistance: 100);
+
+ if (sexToy != null)
+ return true;
+
+ return false;
+ }
+
}
}
diff --git a/Source/ThingComps/CompProperties_SexToy.cs b/Source/ThingComps/CompProperties_SexToy.cs
index 3dc7f3c..164e945 100644
--- a/Source/ThingComps/CompProperties_SexToy.cs
+++ b/Source/ThingComps/CompProperties_SexToy.cs
@@ -9,6 +9,7 @@ using Verse;
namespace RJW_ToysAndMasturbation {
public class CompProperties_SexToy : CompProperties {
+ public Gender primaryGender = Gender.Female;
public CompProperties_SexToy() {
compClass = typeof(CompSexToy);
}
diff --git a/Source/ThingComps/CompSexToy.cs b/Source/ThingComps/CompSexToy.cs
index b7a2b6c..1470786 100644
--- a/Source/ThingComps/CompSexToy.cs
+++ b/Source/ThingComps/CompSexToy.cs
@@ -13,6 +13,8 @@ namespace RJW_ToysAndMasturbation {
public static IntVec3 FapLocation(Pawn p) => (new JobGiver_Masturbate()).FindFapLocation(p);
+ public CompProperties_SexToy Props => (CompProperties_SexToy)props;
+
public override IEnumerable CompFloatMenuOptions(Pawn pawn) {
if (!pawn.CanReach(parent, PathEndMode.Touch, Danger.Deadly)) {