diff --git a/Assemblies/RJW-ToysAndMasturbation.dll b/Assemblies/RJW-ToysAndMasturbation.dll index 760c351..418f191 100644 Binary files a/Assemblies/RJW-ToysAndMasturbation.dll and b/Assemblies/RJW-ToysAndMasturbation.dll differ diff --git a/Defs/ThingDefs/SexToys.xml b/Defs/ThingDefs/SexToys.xml index e161971..ddd09b5 100644 --- a/Defs/ThingDefs/SexToys.xml +++ b/Defs/ThingDefs/SexToys.xml @@ -7,7 +7,6 @@
  • CompQuality
  • -
  • true 0.0 @@ -19,7 +18,7 @@ true 8 Item - Never + Normal
  • Exotic
  • @@ -32,7 +31,14 @@ SexToysDildo A simple dildo for masturbation. - + +
  • + +
  • vagina
  • + + +
  • + Things/SexToys/Dildo CutoutComplex diff --git a/Patches/HumpshroomPatch.xml b/Patches/HumpshroomPatch.xml index f1eabe1..90ba40c 100644 --- a/Patches/HumpshroomPatch.xml +++ b/Patches/HumpshroomPatch.xml @@ -1,5 +1,6 @@  + diff --git a/Source/JobGivers/JobGiver_MasturbateWithToy.cs b/Source/JobGivers/JobGiver_MasturbateWithToy.cs index cf899e1..1afac37 100644 --- a/Source/JobGivers/JobGiver_MasturbateWithToy.cs +++ b/Source/JobGivers/JobGiver_MasturbateWithToy.cs @@ -24,6 +24,9 @@ namespace RJW_ToysAndMasturbation { if(findSexToyOnMap(pawn, out Thing sexToy)) { if ((SexUtility.ReadyForLovin(pawn) && (!xxx.is_whore(pawn) || pawn.IsPrisoner || xxx.is_slave(pawn))) || xxx.is_frustrated(pawn)) { + + IntVec3 fapLocation = FapLocation(pawn); + if (RJWPreferenceSettings.FapInBed && pawn.jobs.curDriver is JobDriver_LayDown) { Building_Bed bed = ((JobDriver_LayDown)pawn.jobs.curDriver).Bed; if (bed != null) { @@ -34,8 +37,9 @@ namespace RJW_ToysAndMasturbation { } } - else if (RJWPreferenceSettings.FapEverywhere && (xxx.is_frustrated(pawn) || xxx.has_quirk(pawn, "Exhibitionist"))) { - Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, sexToy, null, FapLocation(pawn)); + else if (RJWPreferenceSettings.FapEverywhere && (xxx.is_frustrated(pawn) || xxx.has_quirk(pawn, "Exhibitionist")) + && ReachabilityUtility.CanReach(pawn, fapLocation, PathEndMode.OnCell, Danger.Some)) { + Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, sexToy, null, fapLocation); j.count = 1; return j; } @@ -51,6 +55,8 @@ namespace RJW_ToysAndMasturbation { public static bool findSexToyOnMap(Pawn p, out Thing sexToy) { + sexToy = null; + Predicate validator = delegate (Thing t) { if(t.TryGetComp() == null) { return false; @@ -66,8 +72,33 @@ namespace RJW_ToysAndMasturbation { return false; }; + Predicate validatorForBed = 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)) + && t.GetRoom(RegionType.Set_All) == p.CurrentBed().GetRoom(RegionType.Set_All)) + { + return true; + } - sexToy = GenClosest.ClosestThingReachable(p.Position, p.Map, ThingRequest.ForGroup(ThingRequestGroup.HaulableAlways), PathEndMode.OnCell, TraverseParms.For(p), validator: validator, maxDistance: 100); + return false; + }; + + if (p.CurrentBed() != null) + { + sexToy = GenClosest.ClosestThingReachable(p.Position, p.Map, ThingRequest.ForGroup(ThingRequestGroup.HaulableAlways), PathEndMode.OnCell, TraverseParms.For(p), validator: validatorForBed, maxDistance: 100); + } + + if(sexToy == null) + { + 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; diff --git a/Source/ThingComps/CompProperties_SexToy.cs b/Source/ThingComps/CompProperties_SexToy.cs index a6b0ee8..b55028b 100644 --- a/Source/ThingComps/CompProperties_SexToy.cs +++ b/Source/ThingComps/CompProperties_SexToy.cs @@ -5,12 +5,14 @@ using System.Text; using System.Threading.Tasks; using RimWorld; using Verse; +using rjw; namespace RJW_ToysAndMasturbation { public class CompProperties_SexToy : CompProperties { public Gender primaryGender = Gender.Female; public float satisfactionModifier = 1.5f; + public List requiredBodyParts; public CompProperties_SexToy() { compClass = typeof(CompSexToy); } diff --git a/Source/ThingComps/CompSexToy.cs b/Source/ThingComps/CompSexToy.cs index c4df969..745511c 100644 --- a/Source/ThingComps/CompSexToy.cs +++ b/Source/ThingComps/CompSexToy.cs @@ -15,6 +15,7 @@ namespace RJW_ToysAndMasturbation { public CompProperties_SexToy Props => (CompProperties_SexToy)props; + public override IEnumerable CompFloatMenuOptions(Pawn pawn) { if (!pawn.CanReach(parent, PathEndMode.Touch, Danger.Deadly)) { @@ -54,6 +55,8 @@ namespace RJW_ToysAndMasturbation { } + + private string FloatMenuOptionLabel(Pawn pawn) { return "Masturbate with toy"; }