mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Refactor BabyPawnKindDecider and improve the decision process
This commit is contained in:
parent
bfcb469969
commit
4949cac289
2 changed files with 19 additions and 35 deletions
Binary file not shown.
|
@ -97,53 +97,39 @@ namespace RJW_Menstruation
|
|||
|
||||
bool IsAndroidmother = AndroidsCompatibility.IsAndroid(mother);
|
||||
bool IsAndroidfather = AndroidsCompatibility.IsAndroid(father);
|
||||
if (IsAndroidmother && !IsAndroidfather)
|
||||
{
|
||||
spawn_kind_def = fatherKindDef;
|
||||
}
|
||||
else if (!IsAndroidmother && IsAndroidfather)
|
||||
{
|
||||
spawn_kind_def = motherKindDef;
|
||||
}
|
||||
if (IsAndroidmother != IsAndroidfather)
|
||||
spawn_kind_def = IsAndroidmother ? fatherKindDef : motherKindDef;
|
||||
|
||||
string MotherRaceName = "";
|
||||
string FatherRaceName = "";
|
||||
MotherRaceName = motherKindDef?.race?.defName;
|
||||
PawnKindDef non_hybrid_kind_def = spawn_kind_def;
|
||||
if (father != null)
|
||||
FatherRaceName = fatherKindDef?.race?.defName;
|
||||
string MotherRaceName = motherKindDef?.race?.defName;
|
||||
string FatherRaceName = fatherKindDef?.race?.defName;
|
||||
|
||||
|
||||
if (FatherRaceName != "" && Configurations.UseHybridExtention)
|
||||
if (MotherRaceName != FatherRaceName && !FatherRaceName.NullOrEmpty())
|
||||
{
|
||||
spawn_kind_def = GetHybrid(father, mother);
|
||||
//Log.Message("pawnkind: " + spawn_kind_def?.defName);
|
||||
}
|
||||
|
||||
if (MotherRaceName != FatherRaceName && FatherRaceName != "")
|
||||
{
|
||||
if (!Configurations.UseHybridExtention || spawn_kind_def == null)
|
||||
PawnKindDef hybridPawnKind = Configurations.UseHybridExtention ? GetHybrid(father, mother) : null;
|
||||
if (hybridPawnKind != null)
|
||||
{
|
||||
spawn_kind_def = hybridPawnKind;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawn_kind_def = non_hybrid_kind_def;
|
||||
IEnumerable<RaceGroupDef> groups = DefDatabase<RaceGroupDef>.AllDefs.Where(x => !(x.hybridRaceParents.NullOrEmpty() || x.hybridChildKindDef.NullOrEmpty()));
|
||||
|
||||
|
||||
//ModLog.Message(" found custom RaceGroupDefs " + groups.Count());
|
||||
foreach (RaceGroupDef t in groups)
|
||||
foreach (RaceGroupDef def in groups)
|
||||
{
|
||||
if ((t.hybridRaceParents.Contains(MotherRaceName) && t.hybridRaceParents.Contains(FatherRaceName))
|
||||
|| (t.hybridRaceParents.Contains("Any") && (t.hybridRaceParents.Contains(MotherRaceName) || t.hybridRaceParents.Contains(FatherRaceName))))
|
||||
if ((def.hybridRaceParents.Contains(MotherRaceName) && def.hybridRaceParents.Contains(FatherRaceName))
|
||||
|| (def.hybridRaceParents.Contains("Any") && (def.hybridRaceParents.Contains(MotherRaceName) || def.hybridRaceParents.Contains(FatherRaceName))))
|
||||
{
|
||||
//ModLog.Message(" has hybridRaceParents");
|
||||
if (t.hybridChildKindDef.Contains("MotherKindDef"))
|
||||
if (def.hybridChildKindDef.Contains("MotherKindDef"))
|
||||
spawn_kind_def = motherKindDef;
|
||||
else if (t.hybridChildKindDef.Contains("FatherKindDef") && father != null)
|
||||
else if (def.hybridChildKindDef.Contains("FatherKindDef") && father != null)
|
||||
spawn_kind_def = fatherKindDef;
|
||||
else
|
||||
{
|
||||
//ModLog.Message(" trying hybridChildKindDef " + t.defName);
|
||||
List<PawnKindDef> child_kind_def_list = new List<PawnKindDef>();
|
||||
child_kind_def_list.AddRange(DefDatabase<PawnKindDef>.AllDefs.Where(x => t.hybridChildKindDef.Contains(x.defName)));
|
||||
child_kind_def_list.AddRange(DefDatabase<PawnKindDef>.AllDefs.Where(x => def.hybridChildKindDef.Contains(x.defName)));
|
||||
|
||||
//ModLog.Message(" found custom hybridChildKindDefs " + t.hybridChildKindDef.Count);
|
||||
if (!child_kind_def_list.NullOrEmpty())
|
||||
|
@ -152,12 +138,10 @@ namespace RJW_Menstruation
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (!Configurations.UseHybridExtention || spawn_kind_def == null)
|
||||
{
|
||||
if (spawn_kind_def == null)
|
||||
spawn_kind_def = mother.RaceProps?.AnyPawnKind ?? motherKindDef;
|
||||
}
|
||||
|
||||
if (spawn_kind_def.defName.Contains("Nymph"))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue