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

View file

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

View file

@ -24,6 +24,9 @@ namespace RJW_ToysAndMasturbation {
if(findSexToyOnMap(pawn, out Thing sexToy)) { 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 ((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) { if (RJWPreferenceSettings.FapInBed && pawn.jobs.curDriver is JobDriver_LayDown) {
Building_Bed bed = ((JobDriver_LayDown)pawn.jobs.curDriver).Bed; Building_Bed bed = ((JobDriver_LayDown)pawn.jobs.curDriver).Bed;
if (bed != null) { if (bed != null) {
@ -34,8 +37,9 @@ namespace RJW_ToysAndMasturbation {
} }
} }
else if (RJWPreferenceSettings.FapEverywhere && (xxx.is_frustrated(pawn) || xxx.has_quirk(pawn, "Exhibitionist"))) { else if (RJWPreferenceSettings.FapEverywhere && (xxx.is_frustrated(pawn) || xxx.has_quirk(pawn, "Exhibitionist"))
Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, sexToy, null, FapLocation(pawn)); && ReachabilityUtility.CanReach(pawn, fapLocation, PathEndMode.OnCell, Danger.Some)) {
Job j = JobMaker.MakeJob(MasturbateToyDefOf.MasturbateWithToy, sexToy, null, fapLocation);
j.count = 1; j.count = 1;
return j; return j;
} }
@ -51,6 +55,8 @@ namespace RJW_ToysAndMasturbation {
public static bool findSexToyOnMap(Pawn p, out Thing sexToy) { public static bool findSexToyOnMap(Pawn p, out Thing sexToy) {
sexToy = null;
Predicate<Thing> validator = delegate (Thing t) { Predicate<Thing> validator = delegate (Thing t) {
if(t.TryGetComp<CompSexToy>() == null) { if(t.TryGetComp<CompSexToy>() == null) {
return false; return false;
@ -66,8 +72,33 @@ namespace RJW_ToysAndMasturbation {
return false; 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;
}
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);
}
sexToy = GenClosest.ClosestThingReachable(p.Position, p.Map, ThingRequest.ForGroup(ThingRequestGroup.HaulableAlways), PathEndMode.OnCell, TraverseParms.For(p), validator: validator, maxDistance: 100);
if (sexToy != null) if (sexToy != null)
return true; return true;

View file

@ -5,12 +5,14 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using RimWorld; using RimWorld;
using Verse; using Verse;
using rjw;
namespace RJW_ToysAndMasturbation { namespace RJW_ToysAndMasturbation {
public class CompProperties_SexToy : CompProperties { public class CompProperties_SexToy : CompProperties {
public Gender primaryGender = Gender.Female; public Gender primaryGender = Gender.Female;
public float satisfactionModifier = 1.5f; public float satisfactionModifier = 1.5f;
public List<string> requiredBodyParts;
public CompProperties_SexToy() { public CompProperties_SexToy() {
compClass = typeof(CompSexToy); compClass = typeof(CompSexToy);
} }

View file

@ -15,6 +15,7 @@ namespace RJW_ToysAndMasturbation {
public CompProperties_SexToy Props => (CompProperties_SexToy)props; public CompProperties_SexToy Props => (CompProperties_SexToy)props;
public override IEnumerable<FloatMenuOption> CompFloatMenuOptions(Pawn pawn) { public override IEnumerable<FloatMenuOption> CompFloatMenuOptions(Pawn pawn) {
if (!pawn.CanReach(parent, PathEndMode.Touch, Danger.Deadly)) { if (!pawn.CanReach(parent, PathEndMode.Touch, Danger.Deadly)) {
@ -54,6 +55,8 @@ namespace RJW_ToysAndMasturbation {
} }
private string FloatMenuOptionLabel(Pawn pawn) { private string FloatMenuOptionLabel(Pawn pawn) {
return "Masturbate with toy"; return "Masturbate with toy";
} }