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

63 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 {
2022-01-23 23:29:13 +00:00
public static IntVec3 FapLocation(Pawn p) => CasualSex_Helper.FindSexLocation(p);
2020-11-05 22:09:05 +00:00
2020-11-06 06:03:16 +00:00
public CompProperties_SexToy Props => (CompProperties_SexToy)props;
2022-01-25 02:18:18 +00:00
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 {
2022-01-25 20:35:15 +00:00
Building_Bed bed = pawn.ownership?.OwnedBed;
if (bed != null && (WanderUtility.InSameRoom(bed.Position, parent.Position, pawn.Map) || RJWPreferenceSettings.FapInBed && pawn.jobs.curDriver is JobDriver_LayDown)) {
2020-11-05 22:09:05 +00:00
2022-01-25 20:35:15 +00:00
Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, parent, bed, bed.Position);
j.count = 1;
pawn.jobs.TryTakeOrderedJob(j);
2020-11-05 22:09:05 +00:00
}
else {
Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, parent, null, FapLocation(pawn));
j.count = 1;
pawn.jobs.TryTakeOrderedJob(j);
}
});
}
}
2022-01-25 02:18:18 +00:00
2020-11-05 22:09:05 +00:00
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
}
}
}