Implemented racegroups as list

Added variable racegroups, which allows multiple racegroups to be selected (usefull for rjw race support). Racegroup is still present for backward compatibility.
This commit is contained in:
Shabakur 2023-01-15 13:30:33 +01:00
parent 209c149a5a
commit 46436a9e04
5 changed files with 61 additions and 20 deletions

View file

@ -11,11 +11,11 @@ namespace RJW_BGS
public class RaceGeneDef : Def
{
public int priority;
public String raceGroup;
public string raceGroup; //keeping this for backwards compatibility
public List<string> raceGroups; //racegroup, but in list form so multiple can be entered, preference to use this over racegroup
public List<string> raceNames;
public List<string> pawnKindNames;
public List<BestialityGeneInheritanceDef> genes;
//public List<float> genechances;
public String hybridName;
}
}

View file

@ -56,8 +56,10 @@ namespace RJW_BGS
{
raceGroupDefs = allDefs.Where(delegate (RaceGeneDef group)
{
String raceGroupDefName = group.raceGroup;
return raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName;
string raceGroupDefName = group.raceGroup;
List<string> list_raceGroupDefName = group.raceGroups;
return (raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName)
|| (list_raceGroupDefName != null && list_raceGroupDefName.Contains(raceGroupDef.defName));
}).ToList<RaceGeneDef>();
}
if (raceGroupDefs.Count() > 0)