diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index fce2807..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,22 +0,0 @@ -# 1.0.1 (2022-12-20) - -- Fix issue with Orgasm Rush throwing an Error on Animal Orgasm (Thanks Shabakur) -- (Internal) Use of RJW methods to clean up racegroupdefs - -# 1.0.0 (2022-12-19) - -Initial Release ! - -Content: - -- Genes for Base-RJW-Genitalia Types -- Genes for Small and Big Genitalia per Genitalia (Breast, Anus, Penis, Vagina) -- Elasticity Gene if Licentia is loaded -- Genes to modulate Cum amount (None, much, very much) -- Male and Female only Genes -- Genes for Genitalia-Amount (2 Penis, 0 Penis, etc.) -- Futa-Gene that adds the other Genitalia, without touching Gender -- Orgasm Rush, restoring sleep for Pawns on Orgasm -- Breeding Genes: Immunity to Mech Birthing Damage, Fertilizing All Eggs in Pawn and more egg space -- Genes that add RJW Traits (Zoophile, Necrophile, Hypersexual, Rapist) -- Animal Gene Inheritance, utilizing Base-RJW Racegroups and a Dictionary for which Genes are how likely to appear in Crossbreeding diff --git a/Common/Assemblies/Rjw-Genes.dll b/Common/Assemblies/Rjw-Genes.dll index 9eef3ca..b65ab1a 100644 Binary files a/Common/Assemblies/Rjw-Genes.dll and b/Common/Assemblies/Rjw-Genes.dll differ diff --git a/Source/Animal_Inheritance/First.cs b/Source/Animal_Inheritance/First.cs index 8194ab3..8d353f7 100644 --- a/Source/Animal_Inheritance/First.cs +++ b/Source/Animal_Inheritance/First.cs @@ -14,7 +14,7 @@ namespace RJW_BGS { static First() { - //RJWcopy.Racegroupdictbuilder(); + RJWcopy.Racegroupdictbuilder(); //Prints all found race dicts (debugging only) //logAllFoundRaceGroupGenes diff --git a/Source/Animal_Inheritance/InheritanceUtility.cs b/Source/Animal_Inheritance/InheritanceUtility.cs index 2b260dd..8456f45 100644 --- a/Source/Animal_Inheritance/InheritanceUtility.cs +++ b/Source/Animal_Inheritance/InheritanceUtility.cs @@ -42,7 +42,8 @@ namespace RJW_BGS public static List SelectGenes(Pawn pawn) { List genelist = new List(); - RaceGeneDef raceGeneDef = RJWcopy.GetRaceGeneDefInternal(pawn); + PawnKindDef pawnKindDef = pawn.kindDef; + RaceGeneDef raceGeneDef = RJWcopy.GetRaceGenDefInternal(pawnKindDef); if (raceGeneDef != null) { foreach (BestialityGeneInheritanceDef gene in raceGeneDef.genes) diff --git a/Source/Animal_Inheritance/RJW_BGSSettings.cs b/Source/Animal_Inheritance/RJW_BGSSettings.cs index 1d5d859..180567c 100644 --- a/Source/Animal_Inheritance/RJW_BGSSettings.cs +++ b/Source/Animal_Inheritance/RJW_BGSSettings.cs @@ -5,7 +5,6 @@ using System.Text; using System.Threading.Tasks; using Verse; using UnityEngine; - namespace RJW_Genes.Animal_Inheritance { public class RJW_BGSSettings : ModSettings diff --git a/Source/Animal_Inheritance/RJWcopies.cs b/Source/Animal_Inheritance/RJWcopies.cs new file mode 100644 index 0000000..2c11074 --- /dev/null +++ b/Source/Animal_Inheritance/RJWcopies.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using rjw; +using Verse; +using RimWorld; + +namespace RJW_BGS +{ + internal class RJWcopy + { + //Code copied from rjw, as their code was internal and I need the dictionary to know which genes to add to the pawn + public static void Racegroupdictbuilder() + { + foreach (PawnKindDef pawnKindDef2 in from pawnKindDef in DefDatabase.AllDefs + where pawnKindDef.race.race != null + select pawnKindDef) + { + RaceGroupDef raceGroupDef = null; + bool temp = TryGetRaceGroupDef(pawnKindDef2, out raceGroupDef); + } + } + + public static bool TryGetRaceGroupDef(PawnKindDef pawnKindDef, out RaceGroupDef raceGroupDef) + { + + if (RaceGroupByPawnKind.TryGetValue(pawnKindDef, out raceGroupDef)) + { + return raceGroupDef != null; + } + raceGroupDef = GetRaceGroupDefInternal(pawnKindDef); + RaceGroupByPawnKind.Add(pawnKindDef, raceGroupDef); + return raceGroupDef != null; + } + + + public static RaceGroupDef GetRaceGroupDefInternal(PawnKindDef kindDef) + { + string raceName = kindDef.race.defName; + string pawnKindName = kindDef.defName; + IEnumerable allDefs = DefDatabase.AllDefs; + List pawnKindDefs = allDefs.Where(delegate (RaceGroupDef group) + { + List pawnKindNames = group.pawnKindNames; + return pawnKindNames != null && pawnKindNames.Contains(pawnKindName); + }).ToList(); + List raceNameDefs = allDefs.Where(delegate (RaceGroupDef group) + { + List raceNames = group.raceNames; + return raceNames != null && raceNames.Contains(raceName); + }).ToList(); + + int availableDefs = pawnKindDefs.Count() + raceNameDefs.Count(); + if (availableDefs == 0) + { + //Exit Early + return null; + } + if (availableDefs == 1) + { + return pawnKindDefs.Concat(raceNameDefs).Single(); + } + + RaceGroupDef result; + if ((result = pawnKindDefs.FirstOrDefault((RaceGroupDef match) => !IsThisMod(match))) == null) + { + if ((result = raceNameDefs.FirstOrDefault((RaceGroupDef match) => !IsThisMod(match))) == null) + { + result = (pawnKindDefs.FirstOrDefault() ?? raceNameDefs.FirstOrDefault()); + } + } + + return result; + } + + //slightly modified copy of code above so it also works for racegenedefs + public static RaceGeneDef GetRaceGenDefInternal(PawnKindDef kindDef) + { + if (kindDef == null) + { + return null; + } + string raceName = kindDef.race.defName; + string pawnKindName = kindDef.defName; + RaceGroupDef raceGroupDef = GetRaceGroupDef(kindDef); + IEnumerable allDefs = DefDatabase.AllDefs; + Log.Message(allDefs.Count().ToString()); + List pawnKindDefs = allDefs.Where(delegate (RaceGeneDef group) + { + List pawnKindNames = group.pawnKindNames; + return pawnKindNames != null && pawnKindNames.Contains(pawnKindName); + }).ToList(); + List raceKindDefs = allDefs.Where(delegate (RaceGeneDef group) + { + List raceNames = group.raceNames; + return raceNames != null && raceNames.Contains(raceName); + }).ToList(); + List raceGroupDefs = new List(); + if (raceGroupDef != null) + { + /* + // Log Messages for Debugging Only, prints the Genes found for this individual + Log.Message("found a raceGroupDef"); + Log.Message(raceGroupDef.defName); + foreach (RaceGeneDef rgd in allDefs) + { + Log.Message(rgd.defName); + } + */ + raceGroupDefs = allDefs.Where(delegate (RaceGeneDef group) + { + String raceGroupDefName = group.raceGroup; + return raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName; + }).ToList(); + } + RaceGeneDef result = null; + //First check if there is a matching pawnkinddef then race, then racegroup + if (pawnKindDefs.Any()) + { + result = pawnKindDefs.RandomElement(); + } + else if (raceKindDefs.Any() && result == null) + { + result = raceKindDefs.RandomElement(); + } + else if (raceGroupDefs.Any() && result == null) + { + result = raceGroupDefs.RandomElement(); + } + else + { + result = null; + } + return result; + + + } + + private static RaceGroupDef GetRaceGroupDef(PawnKindDef kindDef) + { + RaceGroupDef raceGroupDef = null; + bool temp = TryGetRaceGroupDef(kindDef, out raceGroupDef); + return raceGroupDef; + } + + private static bool IsThisMod(Def def) + { + return LoadedModManager.RunningMods.Single((ModContentPack pack) => pack.Name == "RimJobWorld").AllDefs.Contains(def); + } + + private static readonly IDictionary RaceGroupByPawnKind = new Dictionary(); + } + + +} diff --git a/Source/Animal_Inheritance/RaceGeneDef_Helper.cs b/Source/Animal_Inheritance/RaceGeneDef_Helper.cs deleted file mode 100644 index ed6541a..0000000 --- a/Source/Animal_Inheritance/RaceGeneDef_Helper.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using rjw; -using Verse; -using RimWorld; - -namespace RJW_BGS -{ - internal class RJWcopy - { - //code based on racegroupdefinternal which has a similar function - public static RaceGeneDef GetRaceGeneDefInternal(Pawn pawn) - { - PawnKindDef kindDef = pawn.kindDef; - if (kindDef == null) - { - return null; - } - string raceName = kindDef.race.defName; - string pawnKindName = kindDef.defName; - IEnumerable allDefs = DefDatabase.AllDefs; - PawnData pawnData = SaveStorage.DataStore.GetPawnData(pawn); - RaceGroupDef raceGroupDef = pawnData.RaceSupportDef; - List pawnKindDefs = allDefs.Where(delegate (RaceGeneDef group) - { - List pawnKindNames = group.pawnKindNames; - return pawnKindNames != null && pawnKindNames.Contains(pawnKindName); - }).ToList(); - List raceKindDefs = allDefs.Where(delegate (RaceGeneDef group) - { - List raceNames = group.raceNames; - return raceNames != null && raceNames.Contains(raceName); - }).ToList(); - List raceGroupDefs = new List(); - if (raceGroupDef != null) - { - raceGroupDefs = allDefs.Where(delegate (RaceGeneDef group) - { - String raceGroupDefName = group.raceGroup; - return raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName; - }).ToList(); - } - RaceGeneDef result = null; - //First check if there is a matching pawnkinddef then race, then racegroup - if (pawnKindDefs.Any()) - { - result = pawnKindDefs.RandomElement(); - } - else if (raceKindDefs.Any() && result == null) - { - result = raceKindDefs.RandomElement(); - } - else if (raceGroupDefs.Any() && result == null) - { - result = raceGroupDefs.RandomElement(); - } - else - { - result = null; - } - return result; - - - } - } -} diff --git a/Source/Genes/Special/Patch_OrgasmRush.cs b/Source/Genes/Special/Patch_OrgasmRush.cs index 0b881f2..7f4c167 100644 --- a/Source/Genes/Special/Patch_OrgasmRush.cs +++ b/Source/Genes/Special/Patch_OrgasmRush.cs @@ -21,7 +21,7 @@ namespace RJW_Genes if (props.pawn == null || !props.hasPartner()) return; - if (props.pawn.genes != null && props.pawn.genes.HasGene(GeneDefOf.rjw_genes_orgasm_rush)) + if (props.pawn.genes.HasGene(GeneDefOf.rjw_genes_orgasm_rush)) { props.pawn.needs.rest.CurLevel += REST_INCREASE; } diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index c7b5a48..554b542 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -27,7 +27,7 @@ False - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll + ..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll False @@ -35,7 +35,7 @@ False - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\rjw-master\1.4\Assemblies\RJW.dll + ..\..\rjw\1.4\Assemblies\RJW.dll False @@ -50,12 +50,12 @@ - - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll + + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll False - - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll + + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll False @@ -67,7 +67,7 @@ - +