diff --git a/Common/Assemblies/Rjw-Genes.dll b/Common/Assemblies/Rjw-Genes.dll index 8a6459b..5e1c60b 100644 Binary files a/Common/Assemblies/Rjw-Genes.dll and b/Common/Assemblies/Rjw-Genes.dll differ diff --git a/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Aerofleet.xml b/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Aerofleet.xml deleted file mode 100644 index bf2cfee..0000000 --- a/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Aerofleet.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - AA_Aerofleet - -
  • AA_Aerofleet
  • -
  • AA_ColossalAerofleet
  • -
    - -
  • AG_BlueGelProduction
  • -
  • AG_GasBags
  • -
  • AG_AerofleetHead
  • -
  • AG_SlimeBody
  • -
    - -
  • 0.25
  • -
  • 0.25
  • -
  • 0.25
  • -
  • 0.25
  • -
    -
    -
    \ No newline at end of file diff --git a/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Lisks.xml b/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Lisks.xml deleted file mode 100644 index 1fd246a..0000000 --- a/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Lisks.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - AA_lisks_base - - -
  • AG_Spinnerets
  • -
  • AG_EggLaying
  • -
  • AG_FeraliskEyes
  • -
    - -
  • 0.25
  • -
  • 0.25
  • -
  • 0.25
  • -
    -
    - - - AA_Animalisk - -
  • AA_Animalisk
  • -
    - -
  • PsychicAbility_Enhanced
  • -
  • PsychicAbility_Extreme
  • -
    - -
  • 0.8
  • -
  • 0.2
  • -
    -
    - - - AA_Blizzarisk - -
  • AA_Blizzarisk
  • -
    - -
  • MaxTemp_SmallDecrease
  • -
  • MinTemp_SmallDecrease
  • -
  • MinTemp_LargeDecrease
  • -
    - -
  • 0.8
  • -
  • 0.8
  • -
  • 0.2
  • -
    -
    - - - AA_Hotlisk - -
  • AA_Cinderlisk
  • -
  • AA_Dunealisk
  • -
    - -
  • MinTemp_SmallIncrease
  • -
  • MaxTemp_SmallIncrease
  • -
  • MaxTemp_LargeIncrease
  • -
    - -
  • 0.8
  • -
  • 0.8
  • -
  • 0.2
  • -
    -
    - - - AA_Normallisk - -
  • AA_Feralisk
  • -
  • AA_Junglelisk
  • -
    -
    -
    \ No newline at end of file diff --git a/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Wildpodgroup.xml b/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Wildpodgroup.xml deleted file mode 100644 index bb752f9..0000000 --- a/Common/Defs/RaceGeneDefs/Alpha Animals/RaceGeneDefs_Wildpodgroup.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - AA_Wildpodgroup - -
  • AA_Wildpod
  • -
  • AA_Wildpawn
  • -
  • AA_Agaripawn
  • -
  • AA_Agaripod
  • -
    - -
  • AG_FungalSkin
  • -
  • MoveSpeed_Slow
  • -
  • FireWeakness
  • -
  • FireTerror
  • -
  • Robust
  • -
  • Unstoppable
  • -
    - -
  • 0.15
  • -
  • 0.25
  • -
  • 0.25
  • -
  • 0.25
  • -
  • 0.25
  • -
  • 0.25
  • -
    -
    -
    \ No newline at end of file diff --git a/Common/Defs/RaceGeneDefs/RaceGeneDefs_Base.xml b/Common/Defs/RaceGeneDefs/RaceGeneDefs_Base.xml index f2e40b4..2e03f2b 100644 --- a/Common/Defs/RaceGeneDefs/RaceGeneDefs_Base.xml +++ b/Common/Defs/RaceGeneDefs/RaceGeneDefs_Base.xml @@ -3,24 +3,28 @@ Insect_base -
  • AG_InsectBlood
  • -
  • rjw_genes_ovipositor_genitalia
  • +
  • + AG_InsectBlood + 0.5 +
  • +
  • + rjw_genes_ovipositor_genitalia + 0.5 +
  • - -
  • 0.5
  • -
  • 0.5
  • -
    - Slime_base + Slime_base -
  • AG_SlimeBlood
  • -
  • rjw_genes_slime_genitalia
  • -
    - -
  • 0.5
  • -
  • 0.5
  • -
    +
  • + AG_SlimeBlood + 0.5 +
  • +
  • + rjw_genes_slime_genitalia + 0.5 +
  • +
    \ No newline at end of file diff --git a/Common/Defs/RaceGeneDefs/RaceGeneDefs.xml b/Common/Defs/RaceGeneDefs/RaceGeneDefs_Vanilla_Racegroups.xml similarity index 51% rename from Common/Defs/RaceGeneDefs/RaceGeneDefs.xml rename to Common/Defs/RaceGeneDefs/RaceGeneDefs_Vanilla_Racegroups.xml index e137b8c..8453665 100644 --- a/Common/Defs/RaceGeneDefs/RaceGeneDefs.xml +++ b/Common/Defs/RaceGeneDefs/RaceGeneDefs_Vanilla_Racegroups.xml @@ -4,107 +4,101 @@ Canine Canine_Group -
  • Ears_Floppy
  • -
    - -
  • 0.9
  • -
    +
  • + Ears_Floppy + 0.9 +
  • + - + + Insect Insect_Group -
  • Beauty_Ugly
  • +
  • + Beauty_Ugly + 0.5 +
  • - -
  • 0.5
  • -
    Feline Feline_Group -
  • Ears_Cat
  • -
  • Sleepy
  • -
  • DarkVision
  • +
  • + Ears_Cat + 0.9 +
  • +
  • + Sleepy + 0.25 +
  • +
  • + DarkVision + 0.25 +
  • - -
  • 0.9
  • -
  • 0.25
  • -
  • 0.25
  • -
    Dragon Dragon_Group -
  • Unstoppable
  • -
  • Headbone_CenterHorn
  • -
    - -
  • 0.25
  • -
  • 0.9
  • -
    +
  • + Unstoppable + 0.25 +
  • +
  • + Headbone_CenterHorn + 0.9 +
  • +
    Rodent Rodent_Group -
  • Fertile
  • -
    - -
  • 0.25
  • -
    +
  • + Fertile + 0.25 +
  • +
    Racoon Raccon_Group -
  • StrongStomach
  • +
  • + StrongStomach + 0.5 +
  • - -
  • 0.5
  • -
    \ No newline at end of file diff --git a/Common/Defs/RaceGeneDefs/RaceGeneDefs_template.xml b/Common/Defs/RaceGeneDefs/RaceGeneDefs_template.xml index bce3870..20be765 100644 --- a/Common/Defs/RaceGeneDefs/RaceGeneDefs_template.xml +++ b/Common/Defs/RaceGeneDefs/RaceGeneDefs_template.xml @@ -23,16 +23,33 @@ which genes can be inherited -
  • Ears_Floppy
  • -
    - The genes which may be inherited. Use the defName of the gene, you can also add modded genes. - - -
  • 0.9
  • -
    - WIP, the chance of each gene to be inherited. Is in same order as genes, so for the second gene the chance to inherit is based on the second line in geweights. +
  • + Ears_Floppy + 0.5 +
  • +
  • + rjw_genes_slime_genitalia You can add modded genes which will be ignored if the mod is inactive. + 0.5 +
  • + + For each gene you need to find the defname and give it a chance to appear. Each gene is rolled independently. --> + + \ No newline at end of file diff --git a/Source/Animal_Inheritance/GeneChance.cs b/Source/Animal_Inheritance/GeneChance.cs new file mode 100644 index 0000000..2c5453f --- /dev/null +++ b/Source/Animal_Inheritance/GeneChance.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RJW_BGS +{ + public class GeneChance + { + public string defName; + public float chance = 1f; + } +} diff --git a/Source/Animal_Inheritance/InheritanceUtility.cs b/Source/Animal_Inheritance/InheritanceUtility.cs index 57d0205..8d5e953 100644 --- a/Source/Animal_Inheritance/InheritanceUtility.cs +++ b/Source/Animal_Inheritance/InheritanceUtility.cs @@ -53,18 +53,11 @@ namespace RJW_BGS RaceGeneDef raceGeneDef = RJWcopy.GetRaceGenDefInternal(pawnKindDef); if (raceGeneDef != null) { - int num1 = raceGeneDef.genes.Count; - int num2 = raceGeneDef.genechances.Count; - if (num1 != num2) + foreach (GeneChance gene in raceGeneDef.genes) { - Log.Error("The amount of genes and genechanches are different in " + raceGeneDef.defName + ". Can't select genes to inherit"); - return genelist; - } - for (int i = 0; i Rand.Range(0.01f, 1f)) + if (gene.chance >= Rand.Range(0.01f,1f)) { - genelist.Add(DefDatabase.GetNamed(raceGeneDef.genes[i])); + genelist.Add(DefDatabase.GetNamed(gene.defName)); } } } diff --git a/Source/Animal_Inheritance/RJW_BGSSettings.cs b/Source/Animal_Inheritance/RJW_BGSSettings.cs new file mode 100644 index 0000000..180567c --- /dev/null +++ b/Source/Animal_Inheritance/RJW_BGSSettings.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using UnityEngine; +namespace RJW_Genes.Animal_Inheritance +{ + public class RJW_BGSSettings : ModSettings + { + public static void DoWindowContents(Rect inRect) + { + //Copied from RJW settings mostly + Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); + Rect rect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + 300f); + //Widgets.BeginScrollView(outRect, ref RJWSettings.scrollPosition, rect, true); + Listing_Standard listing_Standard = new Listing_Standard(); + listing_Standard.maxOneColumn = true; + listing_Standard.ColumnWidth = rect.width / 2.05f; + listing_Standard.Begin(rect); + listing_Standard.Gap(24f); + listing_Standard.CheckboxLabeled("enabled", ref enabled, "no function yet", 0f, 1f); + //listing_Standard.CheckboxLabeled("sexfrenzy", ref sexfrenzy, "disable the effects", 0f, 1f); + listing_Standard.End(); + } + + public override void ExposeData() + { + base.ExposeData(); + Scribe_Values.Look(ref RJW_BGSSettings.enabled, "enabled", RJW_BGSSettings.enabled, true); + } + + public static bool enabled; + } +} diff --git a/Source/Animal_Inheritance/RJW_BGSSettingsController.cs b/Source/Animal_Inheritance/RJW_BGSSettingsController.cs new file mode 100644 index 0000000..53a7659 --- /dev/null +++ b/Source/Animal_Inheritance/RJW_BGSSettingsController.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using UnityEngine; + +namespace RJW_Genes.Animal_Inheritance +{ + public class RJW_BGSSettingsController : Mod + { + public RJW_BGSSettingsController(ModContentPack content) : base(content) + { + base.GetSettings(); + } + + public override string SettingsCategory() + { + return "RJW Genes Animal Gene Inheritance"; + } + public override void DoSettingsWindowContents(Rect inRect) + { + RJW_BGSSettings.DoWindowContents(inRect); + } + } +} diff --git a/Source/Animal_Inheritance/RJWcopies.cs b/Source/Animal_Inheritance/RJWcopies.cs index 594b922..cabfd63 100644 --- a/Source/Animal_Inheritance/RJWcopies.cs +++ b/Source/Animal_Inheritance/RJWcopies.cs @@ -35,7 +35,7 @@ namespace RJW_BGS return raceGroupDef != null; } - //slightly modified code so it also works racegroupdefs + public static RaceGroupDef GetRaceGroupDefInternal(PawnKindDef kindDef) { string raceName = kindDef.race.defName; @@ -71,6 +71,7 @@ namespace RJW_BGS return result; } + //slightly modified copy of code above so it also works for racegenedefs public static RaceGeneDef GetRaceGenDefInternal(PawnKindDef kindDef) { if (kindDef == null) diff --git a/Source/Animal_Inheritance/RaceGeneDef.cs b/Source/Animal_Inheritance/RaceGeneDef.cs index 0b14e2a..1d7e42b 100644 --- a/Source/Animal_Inheritance/RaceGeneDef.cs +++ b/Source/Animal_Inheritance/RaceGeneDef.cs @@ -10,11 +10,12 @@ namespace RJW_BGS { public class RaceGeneDef : Def { + public String raceGroup; public List raceNames; public List pawnKindNames; - public List genes; - public List genechances; + public List genes; + //public List genechances; public String hybridName; } } diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index e570152..b8edc5b 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -50,9 +50,8 @@ - - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll - False + + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll @@ -64,6 +63,9 @@ + + +