using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class VoiceDef : Def { public List races = new List(); public Gender gender = Gender.None; public List traits = new List(); public bool takesPriority = false; public float randomChanceFactor = 1; public IntRange ticksBetweenPlays = new IntRange(60, 80); public Dictionary sounds = new Dictionary(); public bool VoiceFitsPawn(Pawn pawn) { //doesn't match any of the races if (!races.Exists(x => x == pawn.def)) return false; //doesn't match gender if (gender != Gender.None && pawn.gender != gender) return false; //if traits list is not empty, and pawn doesn't have any of the designated traits, doesn't match if (!traits.Empty() && !traits.Any(trait => pawn.story.traits.HasTrait(trait))) return false; return true; } } }