mirror of
https://gitgud.io/amevarashi/rjw-sexperience-ideology.git
synced 2024-08-15 00:43:19 +00:00
Moved precepts romanceChanceFactor to DefExtention
This commit is contained in:
parent
be1e5c5d5d
commit
f7206347da
5 changed files with 159 additions and 83 deletions
|
@ -1,7 +1,6 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology.Filters
|
||||
|
@ -13,14 +12,14 @@ namespace RJWSexperience.Ideology.Filters
|
|||
public class RelationFilter
|
||||
{
|
||||
public bool? isVeneratedAnimal;
|
||||
public bool? isAlien;
|
||||
public bool? isBloodRelated;
|
||||
public List<PawnRelationDef> hasOneOfRelations;
|
||||
public List<PawnRelationDef> hasNoneOfRelations;
|
||||
public List<BloodRelationDegree> hasOneOfRelationDegrees;
|
||||
|
||||
private bool initialized = false;
|
||||
private HashSet<PawnRelationDef> hasOneOfRelationsHashed;
|
||||
private HashSet<PawnRelationDef> hasNoneOfRelationsHashed;
|
||||
private HashSet<BloodRelationDegree> hasOneOfRelationDegreesHashed;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the pair of pawns fits filter conditions
|
||||
|
@ -31,9 +30,6 @@ namespace RJWSexperience.Ideology.Filters
|
|||
if (isVeneratedAnimal != null && isVeneratedAnimal != pawn.Ideo.IsVeneratedAnimal(partner))
|
||||
return false;
|
||||
|
||||
//if (isAlien != null && isAlien != partner)
|
||||
// return false;
|
||||
|
||||
if (!CheckRelations(pawn, partner))
|
||||
return false;
|
||||
|
||||
|
@ -45,13 +41,15 @@ namespace RJWSexperience.Ideology.Filters
|
|||
if (!initialized)
|
||||
Initialize();
|
||||
|
||||
if (hasNoneOfRelationsHashed == null && hasOneOfRelationsHashed == null && isBloodRelated == null)
|
||||
if (hasNoneOfRelationsHashed == null && hasOneOfRelationsHashed == null && hasOneOfRelationDegreesHashed == null)
|
||||
return true;
|
||||
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(partner);
|
||||
|
||||
if (isBloodRelated != null && isBloodRelated != relations.Any(def => def.familyByBloodRelation))
|
||||
if (hasOneOfRelationDegreesHashed != null && !hasOneOfRelationDegreesHashed.Contains(RelationHelpers.GetBloodRelationDegree(pawn, partner)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(partner);
|
||||
|
||||
if (hasOneOfRelationsHashed != null)
|
||||
{
|
||||
|
@ -78,6 +76,9 @@ namespace RJWSexperience.Ideology.Filters
|
|||
if (!hasOneOfRelations.NullOrEmpty())
|
||||
hasOneOfRelationsHashed = new HashSet<PawnRelationDef>(hasOneOfRelations);
|
||||
|
||||
if (!hasOneOfRelationDegrees.NullOrEmpty())
|
||||
hasOneOfRelationDegreesHashed = new HashSet<BloodRelationDegree>(hasOneOfRelationDegrees);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue