anim comp and features

This commit is contained in:
c0ffee 2022-01-24 18:18:18 -08:00
parent 00e8d5cf4e
commit 456888cdfa
6 changed files with 50 additions and 6 deletions

View File

@ -7,7 +7,6 @@
<li>
<compClass>CompQuality</compClass>
</li>
<li Class="RJW_ToysAndMasturbation.CompProperties_SexToy" />
</comps>
<selectable>true</selectable>
<generateCommonality>0.0</generateCommonality>
@ -19,7 +18,7 @@
<drawGUIOverlay>true</drawGUIOverlay>
<pathCost>8</pathCost>
<altitudeLayer>Item</altitudeLayer>
<tickerType>Never</tickerType>
<tickerType>Normal</tickerType>
<tradeTags>
<li>Exotic</li>
</tradeTags>
@ -32,7 +31,14 @@
<defName>SexToysDildo</defName>
<label>dildo</label>
<description>A simple dildo for masturbation.</description>
<comps>
<li Class="RJW_ToysAndMasturbation.CompProperties_SexToy">
<requiredBodyParts>
<li>vagina</li>
</requiredBodyParts>
</li>
<li Class="Rimworld_Animations.CompProperties_ThingAnimator" />
</comps>
<graphicData>
<texPath>Things/SexToys/Dildo</texPath>
<shaderType>CutoutComplex</shaderType>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<!--
<Operation Class="PatchOperationSequence">
<operations>
<li Class="PatchOperationAdd">
@ -10,4 +11,5 @@
</li>
</operations>
</Operation>
-->
</Patch>

View File

@ -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<Thing> validator = delegate (Thing t) {
if(t.TryGetComp<CompSexToy>() == null) {
return false;
@ -66,8 +72,33 @@ namespace RJW_ToysAndMasturbation {
return false;
};
Predicate<Thing> validatorForBed = 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))
&& 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;

View File

@ -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<string> requiredBodyParts;
public CompProperties_SexToy() {
compClass = typeof(CompSexToy);
}

View File

@ -15,6 +15,7 @@ namespace RJW_ToysAndMasturbation {
public CompProperties_SexToy Props => (CompProperties_SexToy)props;
public override IEnumerable<FloatMenuOption> 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";
}