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

Binary file not shown.

View file

@ -2,7 +2,12 @@
<Defs>
<RJW_BGS.RaceGeneDef Name = "Canine">
<defName>Canine</defName>
<raceGroup>Canine_Group</raceGroup>
<raceGroups>
<li>Canine_Group</li>
<li>CanineAnimal</li>
<li>CanineSingleGenderAnimal</li>
<li>CanineSkinAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Ears_Floppy</defName>
@ -38,7 +43,11 @@
<RJW_BGS.RaceGeneDef>
<defName>Insect</defName>
<raceGroup>Insect_Group</raceGroup>
<raceGroups>
<li>Insect_Group</li>
<li>ArthropodOvipositorAnimal</li>
<li>ArthropodOvipositorHornyAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Beauty_Ugly</defName>
@ -73,7 +82,14 @@
<RJW_BGS.RaceGeneDef>
<defName>Feline</defName>
<raceGroup>Feline_Group</raceGroup>
<raceGroups>
<li>Feline_Group</li>
<li>FelineAnimal</li>
<li>FelineHornyAnimal</li>
<li>FelineSingleGenderAnimal</li>
<li>AA_SandProwlerAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Tail_Furry</defName>
@ -108,7 +124,10 @@
<RJW_BGS.RaceGeneDef>
<defName>Equine</defName>
<raceGroup>Equine_Group</raceGroup>
<raceGroups>
<li>Equine_Group</li>
<li>HorseAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Furskin</defName>
@ -143,7 +162,12 @@
<RJW_BGS.RaceGeneDef>
<defName>Dragon</defName>
<raceGroup>Dragon_Group</raceGroup>
<raceGroups>
<li>Dragon_Group</li>
<li>ThrumboAnimal</li>
<li>DragonAnimal</li>
<li>DragonSingleGenderAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Unstoppable</defName>
@ -166,7 +190,7 @@
<chance>0.1</chance>
</li>
<li>
<defName>rjw_genes_draconic_genitalia</defName>
<defName>rjw_genes_dragon_genitalia</defName>
<chance>0.6</chance>
</li>
<li>
@ -190,7 +214,12 @@
<RJW_BGS.RaceGeneDef>
<defName>Rodent</defName>
<raceGroup>Rodent_Group</raceGroup>
<raceGroups>
<li>Rodent_Group</li>
<li>RodentAnimal</li>
<li>RodentSingleGenderAnimal</li>
<li>DragonSingleGenderAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Furskin</defName>
@ -225,7 +254,10 @@
<RJW_BGS.RaceGeneDef>
<defName>Racoon</defName>
<raceGroup>Raccon_Group</raceGroup>
<raceGroups>
<li>Raccon_Group</li>
<li>RaccoonAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Furskin</defName>

View file

@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<!--
<Defs>
<!-- this is to disable the xml, remove it for your own xml
<RJW_BGS.RaceGeneDef>
<defName>Canine</defName>
defName can be anything you want, as long as it is unique
<raceGroup>Canine_Group</raceGroup>
RJW.Racegroupdef, all animals in the raceGroup will be part of this group, RJW race support uses this so those can be used to quickly add a group
<raceGroups>
<li>Canine_Group</li>
<li>CanineAnimal</li> from racesupport
<li>CanineSingleGenderAnimal</li> from racesupport
<li>CanineSkinAnimal</li> from racesupport
</raceGroups>
RJW.Racegroupdef, all animals in the added raceGroups will be part of this group, RJW race support uses other defnames and overwrite vanilla ones, so add them to if you use it.
<raceNames>
<li> </li>
@ -38,10 +43,10 @@
For each gene you need to find the defname and give it a chance to appear. Each gene is rolled independently.
</RJW_BGS.RaceGeneDef>
-->
this is to disable the xml, remove it for your own xml -->
<!-- You can use parents to have animals get specific genes in addition to the group. So warg children will have a chance for Ears_Floppy, rjw_genes_slime_genitalia and StrongStomach
<!-- this is to disable the xml, remove it for your own xml
You can use parents to have animals get specific genes in addition to the group. So warg children will have a chance for Ears_Floppy, rjw_genes_slime_genitalia and StrongStomach
<RJW_BGS.RaceGeneDef ParentName = "Canine">
<defName>Warg</defName>
<raceNames>
@ -54,5 +59,7 @@
</li>
</genes>
</RJW_BGS.RaceGeneDef>
-->
this is to disable the xml, remove it for your own xml -->
</Defs>

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)