rjw-sexperience-ideology/Source/IdeologyAddon/PreceptWorkers/ThoughtWorker_Precept_BestialBreeding_Social.cs
2025-01-27 21:36:30 +05:00

38 lines
1.6 KiB
C#

using RimWorld;
using rjw;
using System.Linq;
using Verse;
namespace RJWSexperience.Ideology.PreceptWorkers
{
/// <summary>
/// thought worker for a thought that is active when a certain hediff is present, and who's stage depends on the ether state of the pawn
/// Shamelessly taken from: https://github.com/Tachyonite/Pawnmorpher/blob/master/Source/Pawnmorphs/Esoteria/Thoughts/ThoughtWorker_EtherHediff.cs
/// </summary>
public class ThoughtWorker_Precept_BestialBreeding_Social : ThoughtWorker_Precept_Social
{
/// <summary>Gets the current thought state of the given pawn.</summary>
/// <param name="p">The pawn for whom the thoughts are generated.</param>
/// <param name="otherPawn">The pawn about whom the thoughts are generated.</param>
/// <returns></returns>
protected override ThoughtState ShouldHaveThought(Pawn mainPawn, Pawn referencedPawn)
{
if (referencedPawn?.DevelopmentalStage == DevelopmentalStage.Adult && mainPawn?.DevelopmentalStage == DevelopmentalStage.Adult)
{
Map map = referencedPawn.Map;
if (map != null)
{
foreach (var pawnOnMap in map.mapPawns.AllPawns.Where(x => xxx.is_animal(x) && PawnExtensions.IsVisiblyPregnant(x)))
{
if (pawnOnMap != referencedPawn && IdeoUtility.IsFatherOfPregnancy(pawnOnMap, referencedPawn)) // Check if this pawn is the father of p
{
return ThoughtState.ActiveDefault; // Active thought if the pawn is the father
}
}
}
}
// Return default (inactive) if no valid conditions were met
return ThoughtState.Inactive;
}
}
}