Filters for food with cum

This commit is contained in:
amevarashi 2022-04-22 23:28:59 +05:00
parent ad7c00d665
commit ad76a1857b
5 changed files with 80 additions and 0 deletions

View file

@ -128,4 +128,24 @@
</li>
</stages>
</ThoughtDef>
<SpecialThingFilterDef>
<defName>AllowWithCum</defName>
<label>allow food with cum</label>
<description>Allow food that was spiced up by adding sexual fluids.</description>
<parentCategory>Foods</parentCategory>
<allowedByDefault>true</allowedByDefault>
<saveKey>allowWithCum</saveKey>
<workerClass>RJWSexperience.SpecialThingFilterWorker_Cum</workerClass>
</SpecialThingFilterDef>
<SpecialThingFilterDef>
<defName>AllowWithoutCum</defName>
<label>allow food without cum</label>
<description>Allow food normal food.</description>
<parentCategory>Foods</parentCategory>
<allowedByDefault>true</allowedByDefault>
<saveKey>allowWithoutCum</saveKey>
<workerClass>RJWSexperience.SpecialThingFilterWorker_NoCum</workerClass>
</SpecialThingFilterDef>
</Defs>

View file

@ -0,0 +1,12 @@
using Verse;
namespace RJWSexperience
{
public class SpecialThingFilterWorker_Cum : SpecialThingFilterWorker_CumBase
{
public override bool Matches(Thing t)
{
return IsCum(t) || IsFoodWithCum(t);
}
}
}

View file

@ -0,0 +1,33 @@
using RimWorld;
using Verse;
namespace RJWSexperience
{
public abstract class SpecialThingFilterWorker_CumBase : SpecialThingFilterWorker
{
public override bool CanEverMatch(ThingDef def)
{
return def.IsIngestible && def.IsProcessedFood;
}
protected bool IsCum(Thing t) => IsCum(t.def);
protected bool IsCum(ThingDef t) => t == VariousDefOf.GatheredCum;
protected bool IsFoodWithCum(Thing food)
{
CompIngredients compIngredients = food.TryGetComp<CompIngredients>();
if (compIngredients == null)
return false;
foreach (ThingDef ingredient in compIngredients.ingredients)
{
if (IsCum(ingredient))
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,12 @@
using Verse;
namespace RJWSexperience
{
public class SpecialThingFilterWorker_NoCum : SpecialThingFilterWorker_CumBase
{
public override bool Matches(Thing t)
{
return !IsCum(t) && !IsFoodWithCum(t);
}
}
}

View file

@ -70,6 +70,8 @@
<Compile Include="DebugAction.cs" />
<Compile Include="ExtensionMethods\PawnExtensions.cs" />
<Compile Include="ExtensionMethods\SexPropsExtensions.cs" />
<Compile Include="FilterWorkers\SpecialThingFilterWorker_CumBase.cs" />
<Compile Include="FilterWorkers\SpecialThingFilterWorker_NoCum.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Harmony.cs" />
<Compile Include="IngestionOutcomeDoers.cs" />
@ -89,6 +91,7 @@
<Compile Include="Patches\Rimworld_Patch.cs" />
<Compile Include="Patches\RJW_Patch.cs" />
<Compile Include="SexperienceMod.cs" />
<Compile Include="FilterWorkers\SpecialThingFilterWorker_Cum.cs" />
<Compile Include="StatParts.cs" />
<Compile Include="Thoughts\ThoughtDef_Opinionbased.cs" />
<Compile Include="Thoughts\ThoughtDef_Recordbased.cs" />