Refactor allraces and allkinds

This commit is contained in:
lutepickle 2024-02-16 21:52:23 -08:00
parent ebb486179b
commit 8306439576

View file

@ -58,9 +58,8 @@ namespace RJW_Menstruation
get get
{ {
if (allraces != null) return allraces; if (allraces != null) return allraces;
allraces = DefDatabase<ThingDef>.AllDefsListForReading.Where(thingdef => thingdef.race?.IsFlesh ?? false).ToList();
List<ThingDef> allThings = DefDatabase<ThingDef>.AllDefsListForReading;
allraces = allThings.FindAll(x => x.race != null && x.race.IsFlesh);
return allraces; return allraces;
} }
} }
@ -69,9 +68,8 @@ namespace RJW_Menstruation
get get
{ {
if (allkinds != null) return allkinds; if (allkinds != null) return allkinds;
allkinds = DefDatabase<PawnKindDef>.AllDefsListForReading.Where(pawnkinddef => pawnkinddef.race != null).ToList();
List<PawnKindDef> allKinds = DefDatabase<PawnKindDef>.AllDefsListForReading;
allkinds = allKinds.FindAll(x => x.race != null);
return allkinds; return allkinds;
} }
} }