mirror of
https://gitgud.io/amevarashi/rjw-sexperience-ideology.git
synced 2024-08-15 00:43:19 +00:00
Patched manual romance to respect incestuous precepts
This commit is contained in:
parent
180404cee1
commit
3bedfec30e
8 changed files with 254 additions and 10 deletions
47
Source/IdeologyAddon/RelationHelpers.cs
Normal file
47
Source/IdeologyAddon/RelationHelpers.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using RimWorld;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public static class RelationHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Get degree of blood relation between two pawns
|
||||
/// </summary>
|
||||
public static BloodRelationDegree GetBloodRelationDegree(Pawn pawn, Pawn partner)
|
||||
{
|
||||
PawnRelationDef closestBloodRelation = pawn
|
||||
.GetRelations(partner)
|
||||
?.Where(def => def.familyByBloodRelation)
|
||||
?.OrderByDescending(def => def.importance)
|
||||
?.FirstOrFallback();
|
||||
|
||||
if (closestBloodRelation == null)
|
||||
{
|
||||
return BloodRelationDegree.NotRelated;
|
||||
}
|
||||
|
||||
return GetBloodRelationDegree(closestBloodRelation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get degree of blood relation for a relationDef
|
||||
/// </summary>
|
||||
public static BloodRelationDegree GetBloodRelationDegree(PawnRelationDef relationDef)
|
||||
{
|
||||
if (!relationDef.familyByBloodRelation)
|
||||
{
|
||||
return BloodRelationDegree.NotRelated;
|
||||
}
|
||||
else if (relationDef.importance <= PawnRelationDefOf.Cousin.importance)
|
||||
{
|
||||
return BloodRelationDegree.FarRelative;
|
||||
}
|
||||
else
|
||||
{
|
||||
return BloodRelationDegree.CloseRelative;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue