mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Null check in GetMenstruationComps, probably unnecessary. Also simplify HasMenstruationComp
This commit is contained in:
parent
5a64a081c2
commit
6383823e34
2 changed files with 2 additions and 9 deletions
|
@ -19,6 +19,7 @@ namespace RJW_Menstruation
|
||||||
public static IEnumerable<HediffComp_Menstruation> GetMenstruationComps(this Pawn pawn)
|
public static IEnumerable<HediffComp_Menstruation> GetMenstruationComps(this Pawn pawn)
|
||||||
{
|
{
|
||||||
List<Hediff> hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
|
List<Hediff> hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
|
||||||
|
if (hedifflist == null) yield break;
|
||||||
foreach (Hediff hediff in hedifflist)
|
foreach (Hediff hediff in hedifflist)
|
||||||
{
|
{
|
||||||
HediffComp_Menstruation result = hediff.TryGetComp<HediffComp_Menstruation>();
|
HediffComp_Menstruation result = hediff.TryGetComp<HediffComp_Menstruation>();
|
||||||
|
|
|
@ -120,15 +120,7 @@ namespace RJW_Menstruation
|
||||||
|
|
||||||
public static bool HasMenstruationComp(this Pawn pawn)
|
public static bool HasMenstruationComp(this Pawn pawn)
|
||||||
{
|
{
|
||||||
List<Hediff> hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
|
return pawn.GetMenstruationComps().Any();
|
||||||
HediffComp_Menstruation result;
|
|
||||||
if (hedifflist.NullOrEmpty()) return false;
|
|
||||||
foreach (Hediff h in hedifflist)
|
|
||||||
{
|
|
||||||
result = h.TryGetComp<HediffComp_Menstruation>();
|
|
||||||
if (result != null) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HasMenstruationComp(this Hediff hediff)
|
public static bool HasMenstruationComp(this Hediff hediff)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue