Compare commits

..

3 commits

Author SHA1 Message Date
Vegapnk
cc43a5a5aa Started a Changelog, notes for 1.0.1 2022-12-20 08:39:10 +01:00
vegapnk
71a3b65c38
Merge pull request #4 from Shabakur/main
New cleaner method to obtain racegroupdefs and bugfix in Patch_OrgasmRush
2022-12-20 08:29:48 +01:00
Shabakur
b497b9cfc2 New cleaner method to obtain racegroupdefs and bugfix in Patch_OrgasmRush 2022-12-19 20:48:56 +01:00
9 changed files with 102 additions and 168 deletions

22
CHANGELOG.md Normal file
View file

@ -0,0 +1,22 @@
# 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

Binary file not shown.

View file

@ -14,7 +14,7 @@ namespace RJW_BGS
{
static First()
{
RJWcopy.Racegroupdictbuilder();
//RJWcopy.Racegroupdictbuilder();
//Prints all found race dicts (debugging only)
//logAllFoundRaceGroupGenes

View file

@ -42,8 +42,7 @@ namespace RJW_BGS
public static List<GeneDef> SelectGenes(Pawn pawn)
{
List<GeneDef> genelist = new List<GeneDef>();
PawnKindDef pawnKindDef = pawn.kindDef;
RaceGeneDef raceGeneDef = RJWcopy.GetRaceGenDefInternal(pawnKindDef);
RaceGeneDef raceGeneDef = RJWcopy.GetRaceGeneDefInternal(pawn);
if (raceGeneDef != null)
{
foreach (BestialityGeneInheritanceDef gene in raceGeneDef.genes)

View file

@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Verse;
using UnityEngine;
namespace RJW_Genes.Animal_Inheritance
{
public class RJW_BGSSettings : ModSettings

View file

@ -1,157 +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 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<PawnKindDef>.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<RaceGroupDef> allDefs = DefDatabase<RaceGroupDef>.AllDefs;
List<RaceGroupDef> pawnKindDefs = allDefs.Where(delegate (RaceGroupDef group)
{
List<string> pawnKindNames = group.pawnKindNames;
return pawnKindNames != null && pawnKindNames.Contains(pawnKindName);
}).ToList<RaceGroupDef>();
List<RaceGroupDef> raceNameDefs = allDefs.Where(delegate (RaceGroupDef group)
{
List<string> raceNames = group.raceNames;
return raceNames != null && raceNames.Contains(raceName);
}).ToList<RaceGroupDef>();
int availableDefs = pawnKindDefs.Count<RaceGroupDef>() + raceNameDefs.Count<RaceGroupDef>();
if (availableDefs == 0)
{
//Exit Early
return null;
}
if (availableDefs == 1)
{
return pawnKindDefs.Concat(raceNameDefs).Single<RaceGroupDef>();
}
RaceGroupDef result;
if ((result = pawnKindDefs.FirstOrDefault((RaceGroupDef match) => !IsThisMod(match))) == null)
{
if ((result = raceNameDefs.FirstOrDefault((RaceGroupDef match) => !IsThisMod(match))) == null)
{
result = (pawnKindDefs.FirstOrDefault<RaceGroupDef>() ?? raceNameDefs.FirstOrDefault<RaceGroupDef>());
}
}
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<RaceGeneDef> allDefs = DefDatabase<RaceGeneDef>.AllDefs;
Log.Message(allDefs.Count<RaceGeneDef>().ToString());
List<RaceGeneDef> pawnKindDefs = allDefs.Where(delegate (RaceGeneDef group)
{
List<string> pawnKindNames = group.pawnKindNames;
return pawnKindNames != null && pawnKindNames.Contains(pawnKindName);
}).ToList<RaceGeneDef>();
List<RaceGeneDef> raceKindDefs = allDefs.Where(delegate (RaceGeneDef group)
{
List<string> raceNames = group.raceNames;
return raceNames != null && raceNames.Contains(raceName);
}).ToList<RaceGeneDef>();
List<RaceGeneDef> raceGroupDefs = new List<RaceGeneDef>();
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>();
}
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<PawnKindDef, RaceGroupDef> RaceGroupByPawnKind = new Dictionary<PawnKindDef, RaceGroupDef>();
}
}

View file

@ -0,0 +1,69 @@
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<RaceGeneDef> allDefs = DefDatabase<RaceGeneDef>.AllDefs;
PawnData pawnData = SaveStorage.DataStore.GetPawnData(pawn);
RaceGroupDef raceGroupDef = pawnData.RaceSupportDef;
List<RaceGeneDef> pawnKindDefs = allDefs.Where(delegate (RaceGeneDef group)
{
List<string> pawnKindNames = group.pawnKindNames;
return pawnKindNames != null && pawnKindNames.Contains(pawnKindName);
}).ToList<RaceGeneDef>();
List<RaceGeneDef> raceKindDefs = allDefs.Where(delegate (RaceGeneDef group)
{
List<string> raceNames = group.raceNames;
return raceNames != null && raceNames.Contains(raceName);
}).ToList<RaceGeneDef>();
List<RaceGeneDef> raceGroupDefs = new List<RaceGeneDef>();
if (raceGroupDef != null)
{
raceGroupDefs = allDefs.Where(delegate (RaceGeneDef group)
{
String raceGroupDefName = group.raceGroup;
return raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName;
}).ToList<RaceGeneDef>();
}
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;
}
}
}

View file

@ -21,7 +21,7 @@ namespace RJW_Genes
if (props.pawn == null || !props.hasPartner())
return;
if (props.pawn.genes.HasGene(GeneDefOf.rjw_genes_orgasm_rush))
if (props.pawn.genes != null && props.pawn.genes.HasGene(GeneDefOf.rjw_genes_orgasm_rush))
{
props.pawn.needs.rest.CurLevel += REST_INCREASE;
}

View file

@ -27,7 +27,7 @@
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="LicentiaLabs">
@ -35,7 +35,7 @@
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\..\rjw\1.4\Assemblies\RJW.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\rjw-master\1.4\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
@ -50,12 +50,12 @@
<None Include="..\Common\Defs\Genes\GeneDefs_GenitaliaTypeEndogenes.xml" />
<None Include="..\Common\Languages\**" />
<None Include="..\Common\Patches\**" />
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
@ -67,7 +67,7 @@
<Compile Include="Animal_Inheritance\PatchRJWHediffInsect_Egg.cs" />
<Compile Include="Animal_Inheritance\PatchVanillaPregnancyUtility.cs" />
<Compile Include="Animal_Inheritance\RaceGeneDef.cs" />
<Compile Include="Animal_Inheritance\RJWcopies.cs" />
<Compile Include="Animal_Inheritance\RaceGeneDef_Helper.cs" />
<Compile Include="Animal_Inheritance\RJW_BGSSettings.cs" />
<Compile Include="Animal_Inheritance\RJW_BGSSettingsController.cs" />
<Compile Include="Animal_Inheritance\BestialityGeneInheritanceDef.cs" />