mirror of
https://gitgud.io/c0ffeeeeeeee/rjw-toys-and-masturbation.git
synced 2024-08-15 00:43:44 +00:00
79 lines
2.4 KiB
C#
79 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using RimWorld;
|
|
using rjw;
|
|
using Verse;
|
|
using Verse.AI;
|
|
|
|
namespace RJW_ToysAndMasturbation {
|
|
class JobGiver_MasturbateWithToy : ThinkNode_JobGiver {
|
|
|
|
public static IntVec3 FapLocation(Pawn p) => CasualSex_Helper.FindSexLocation(p);
|
|
|
|
protected override Job TryGiveJob(Pawn pawn) {
|
|
|
|
if (pawn.Drafted) {
|
|
return null;
|
|
}
|
|
if (!xxx.can_be_fucked(pawn) && !xxx.can_fuck(pawn)) {
|
|
return null;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
public static bool findSexToyOnMap(Pawn p, out Thing sexToy) {
|
|
|
|
Predicate<Thing> validator = delegate (Thing t) {
|
|
if(t.TryGetComp<CompSexToy>() == null) {
|
|
return false;
|
|
}
|
|
//homo check
|
|
if (t.TryGetComp<CompSexToy>().Props.primaryGender == p.gender ||
|
|
(t.TryGetComp<CompSexToy>().Props.primaryGender == Gender.Male && xxx.can_fuck(p) && (RJWPreferenceSettings.FeMalesex == RJWPreferenceSettings.AllowedSex.All || RJWPreferenceSettings.FeMalesex == RJWPreferenceSettings.AllowedSex.Homo)) ||
|
|
(t.TryGetComp<CompSexToy>().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;
|
|
}
|
|
|
|
}
|
|
}
|