mirror of
https://gitgud.io/c0ffeeeeeeee/coffees-rjw-ideology-addons.git
synced 2024-08-14 23:57:38 +00:00
filters and vanilla cooking expanded
This commit is contained in:
parent
266356123e
commit
40a681a685
6 changed files with 80 additions and 1 deletions
Binary file not shown.
|
@ -92,6 +92,9 @@
|
|||
<Compile Include="Source\RoleRequirements\RoleRequirement_Lactating.cs" />
|
||||
<Compile Include="Source\StatDefOf\StatDefOf_Lactation.cs" />
|
||||
<Compile Include="Source\ThingDefOf\ThingDefOf_Milk.cs" />
|
||||
<Compile Include="Source\ThingFilters\SpecialThingFilterWorker_Milk.cs" />
|
||||
<Compile Include="Source\ThingFilters\SpecialThingFilterWorker_MilkBase.cs" />
|
||||
<Compile Include="Source\ThingFilters\SpecialThingFilterWorker_NoMilk.cs" />
|
||||
<Compile Include="Source\Thoughts\ThoughtWorker_Precept_Lactating_Essential.cs" />
|
||||
<Compile Include="Source\Thoughts\ThoughtWorker_Precept_Lactating_Essential_Social.cs" />
|
||||
<Compile Include="Source\Thoughts\ThoughtWorker_Precept_NoRecentHumanMilk.cs" />
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace CRIALactation
|
|||
if (ingester.Ideo != null)
|
||||
{
|
||||
|
||||
if (ingredient == ThingDefOf_Milk.HumanoidMilk || ingredient == ThingDefOf_Milk.HumanMilk)
|
||||
if (ingredient == ThingDefOf_Milk.HumanoidMilk || ingredient == ThingDefOf_Milk.HumanMilk || ingredient.defName == "VCE_HumanoidCheese")
|
||||
{
|
||||
AddThoughtsFromIdeo_Patch(HistoryEventDefOf_Milk.DrankMilkMeal, ingester, ingredient, meatSourceCategory);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace CRIALactation.Source.ThingFilters
|
||||
{
|
||||
class SpecialThingFilterWorker_Milk : SpecialThingFilterWorker_MilkBase
|
||||
{
|
||||
public override bool Matches(Thing t)
|
||||
{
|
||||
return IsHumanMilk(t) || IsFoodWithMilk(t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using Milk;
|
||||
|
||||
namespace CRIALactation
|
||||
{
|
||||
public abstract class SpecialThingFilterWorker_MilkBase : SpecialThingFilterWorker
|
||||
{
|
||||
|
||||
protected bool IsHumanMilk(ThingDef t) => t == ThingDefOf_Milk.HumanMilk || t == ThingDefOf_Milk.HumanoidMilk;
|
||||
|
||||
protected bool IsHumanMilk(Thing t) => IsHumanMilk(t.def);
|
||||
|
||||
public override bool CanEverMatch(ThingDef def)
|
||||
{
|
||||
return def.IsIngestible && def.IsProcessedFood;
|
||||
}
|
||||
|
||||
protected bool IsFoodWithMilk(Thing food)
|
||||
{
|
||||
CompIngredients compIngredients = food.TryGetComp<CompIngredients>();
|
||||
|
||||
if (compIngredients == null)
|
||||
return false;
|
||||
|
||||
foreach (ThingDef ingredient in compIngredients.ingredients)
|
||||
{
|
||||
if (IsHumanMilk(ingredient))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace CRIALactation
|
||||
{
|
||||
class SpecialThingFilterWorker_NoMilk : SpecialThingFilterWorker_MilkBase
|
||||
{
|
||||
public override bool Matches(Thing t)
|
||||
{
|
||||
return !(IsHumanMilk(t) || IsFoodWithMilk(t));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue