rjw-toys-and-masturbation/Source/ThingComps/CompSexToy.cs

62 lines
1.9 KiB
C#
Raw Normal View History

2020-11-05 22:09:05 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using Verse.AI;
using rjw;
namespace RJW_ToysAndMasturbation {
public class CompSexToy : ThingComp {
public static IntVec3 FapLocation(Pawn p) => (new JobGiver_Masturbate()).FindFapLocation(p);
2020-11-06 06:03:16 +00:00
public CompProperties_SexToy Props => (CompProperties_SexToy)props;
2020-11-05 22:09:05 +00:00
public override IEnumerable<FloatMenuOption> CompFloatMenuOptions(Pawn pawn) {
if (!pawn.CanReach(parent, PathEndMode.Touch, Danger.Deadly)) {
yield return new FloatMenuOption(FloatMenuOptionLabel(pawn) + " (" + "NoPath".Translate() + ")", null);
}
else if (!pawn.CanReserve(parent)) {
yield return new FloatMenuOption(FloatMenuOptionLabel(pawn) + " (" + "Reserved".Translate() + ")", null);
}
else if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation)) {
yield return new FloatMenuOption(FloatMenuOptionLabel(pawn) + " (" + "Incapable".Translate() + ")", null);
}
else if (!xxx.can_be_fucked(pawn) && !xxx.can_fuck(pawn)) {
yield return new FloatMenuOption(FloatMenuOptionLabel(pawn) + " (" + "Incapable".Translate() + ")", null);
}
else {
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 (bed != null) {
Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, parent, bed, bed.Position);
j.count = 1;
pawn.jobs.TryTakeOrderedJob(j);
}
}
else {
Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, parent, null, FapLocation(pawn));
j.count = 1;
pawn.jobs.TryTakeOrderedJob(j);
}
});
}
}
private string FloatMenuOptionLabel(Pawn pawn) {
2020-11-05 22:52:02 +00:00
return "Masturbate with toy";
2020-11-05 22:09:05 +00:00
}
}
}