RJW-Sexperience/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_Cu...

32 lines
695 B
C#
Raw Normal View History

2022-04-22 18:28:59 +00:00
using RimWorld;
using Verse;
namespace RJWSexperience.Cum.FilterWorkers
2022-04-22 18:28:59 +00:00
{
public abstract class SpecialThingFilterWorker_CumBase : SpecialThingFilterWorker
{
public override bool CanEverMatch(ThingDef def)
{
return def.IsIngestible && def.IsProcessedFood;
}
protected bool IsCum(ThingDef t) => t == RsDefOf.Thing.GatheredCum;
2022-04-22 18:28:59 +00:00
protected bool IsFoodWithCum(Thing food)
{
CompIngredients compIngredients = food.TryGetComp<CompIngredients>();
if (compIngredients?.ingredients == null)
2022-04-22 18:28:59 +00:00
return false;
for (int i = 0; i < compIngredients.ingredients.Count; i++)
2022-04-22 18:28:59 +00:00
{
if (IsCum(compIngredients.ingredients[i]))
2022-04-22 18:28:59 +00:00
return true;
}
return false;
}
}
}