mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Add PeekBaby and BabyCount to PregeneratedBabies
This commit is contained in:
parent
afcb7bf7c5
commit
64923264b9
4 changed files with 21 additions and 6 deletions
Binary file not shown.
|
@ -21,7 +21,22 @@ namespace RJW_Menstruation
|
|||
|
||||
public bool HasBaby
|
||||
{
|
||||
get => !babies.NullOrEmpty();
|
||||
get => !babies.NullOrEmpty();
|
||||
}
|
||||
|
||||
public int BabyCount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (babies == null) return 0;
|
||||
else return babies.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public Pawn PeekBaby()
|
||||
{
|
||||
if (babies.NullOrEmpty()) return null;
|
||||
else return babies.First();
|
||||
}
|
||||
|
||||
public Pawn PopBaby()
|
||||
|
@ -210,7 +225,7 @@ namespace RJW_Menstruation
|
|||
float birthQuality = PregnancyUtility.GetBirthQualityFor(mother);
|
||||
do
|
||||
{
|
||||
Pawn baby = comp.babies[0];
|
||||
Pawn baby = comp.PeekBaby();
|
||||
Pawn thisFather = baby.GetFather() ?? father;
|
||||
baby.relations.ClearAllRelations(); // To keep ApplyBirthOutcome from erroring when it tries to set up relations
|
||||
|
||||
|
@ -269,7 +284,7 @@ namespace RJW_Menstruation
|
|||
// Though even if it does, that's probably okay. More babies more memories after all
|
||||
do
|
||||
{
|
||||
Pawn baby = comp.babies[0];
|
||||
Pawn baby = comp.PeekBaby();
|
||||
Pawn thisFather = baby.GetFather() ?? father;
|
||||
baby.relations.ClearAllRelations();
|
||||
|
||||
|
|
|
@ -118,8 +118,8 @@ namespace RJW_Menstruation
|
|||
}
|
||||
else if (babiescomp?.HasBaby ?? false)
|
||||
{
|
||||
babydef = babiescomp.babies.First().def;
|
||||
babycount = babiescomp.babies.Count;
|
||||
babydef = babiescomp.PeekBaby().def;
|
||||
babycount = babiescomp.BabyCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -178,7 +178,7 @@ namespace RJW_Menstruation
|
|||
}
|
||||
}
|
||||
HediffComp_PregeneratedBabies babiescomp = comp.Pregnancy.TryGetComp<HediffComp_PregeneratedBabies>();
|
||||
return babiescomp?.babies?.FirstOrDefault();
|
||||
return babiescomp?.PeekBaby();
|
||||
}
|
||||
|
||||
public static void DrawBreastIcon(this Pawn pawn, Rect rect)
|
||||
|
|
Loading…
Reference in a new issue