mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Added a lot of debugging logs for Bestiality Gene Inheritance
This commit is contained in:
parent
0203cd92a9
commit
712bb909c6
9 changed files with 97 additions and 40 deletions
|
@ -8,6 +8,10 @@ Features:
|
|||
- Age-Transfer and Youth-Fountain per Sex Gene
|
||||
- Bisexual and Homosexual Genes with Placeholder Icon
|
||||
- Balancing some Genes by changing metabolism and complexity
|
||||
- Pheromone Gene (#13, Shabakur)
|
||||
- RJW Race-Support Compatibility (#12,#13, Shabakur)
|
||||
- Animal Gene Inheritance Gene-Chance Multiplier per Setting (#13, Shabakur)
|
||||
- Lots of Debug-Only Logging for Animal Gene Inheritance
|
||||
|
||||
Succubus:
|
||||
|
||||
|
@ -17,6 +21,7 @@ Fixes:
|
|||
- Error on Game Load when Licentia Genes are tried to be added to Xenotypes for players without Licentia (#5)
|
||||
- Futa Gene only triggers if Pawn is not a futa already (#2)
|
||||
- Genitalia Resizing triggers on 20th Birthday (#11)
|
||||
- RJW-Gene-Inheritance Settings now do things (#13, Shabakur)
|
||||
|
||||
# 1.0.1 (2022-12-20)
|
||||
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RJW_BGS
|
||||
namespace RJW_BGS
|
||||
{
|
||||
public class BestialityGeneInheritanceDef
|
||||
{
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
|
@ -20,14 +16,18 @@ namespace RJW_BGS
|
|||
if (mother.RaceProps.Humanlike && father.RaceProps.Humanlike)
|
||||
return genelist;
|
||||
|
||||
|
||||
ModLog.Message($"Trigger an Animal-Gene-Inheritance for {father.Name} and {mother.Name}");
|
||||
//One parent must be an animal and the other must be human, so only one needs to return
|
||||
if (father != null && !father.RaceProps.Humanlike)
|
||||
{
|
||||
if (RJW_BGSSettings.rjw_bgs_detailed_debug)
|
||||
ModLog.Message($"Father was found to be animal - looking up genes for {father.Name}");
|
||||
return SelectGenes(father);
|
||||
}
|
||||
if (mother != null && !mother.RaceProps.Humanlike)
|
||||
{
|
||||
if (RJW_BGSSettings.rjw_bgs_detailed_debug)
|
||||
ModLog.Message($"Mother was found to be animal - looking up genes for {mother.Name}");
|
||||
return SelectGenes(mother);
|
||||
}
|
||||
|
||||
|
@ -48,30 +48,48 @@ namespace RJW_BGS
|
|||
{
|
||||
foreach (BestialityGeneInheritanceDef gene in raceGeneDef.genes)
|
||||
{
|
||||
if (gene.chance * RJW_BGSSettings.global_gene_chance >= Rand.Range(0.01f,1f))
|
||||
if (gene.chance * RJW_BGSSettings.rjw_bgs_global_gene_chance >= Rand.Range(0.01f,1f))
|
||||
{
|
||||
genelist.Add(DefDatabase<GeneDef>.GetNamed(gene.defName));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (RJW_BGSSettings.rjw_bgs_detailed_debug)
|
||||
ModLog.Message($"From {raceGeneDef.genes.Count} possible genes in {raceGeneDef.defName}, {genelist.Count} were added by chance ({RJW_BGSSettings.rjw_bgs_global_gene_chance} chance multiplier from Settings).");
|
||||
return genelist;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds a list of Genes to the pawns existing GeneSet.
|
||||
/// Whether it is added as a Xenogene or Endogene is configured in Mod-Settings.
|
||||
/// </summary>
|
||||
/// <param name="pawn">The pawn for which Genes will be added</param>
|
||||
/// <param name="genes">The Genes to add (Endogene by default, Xenogene with Mod Settings)</param>
|
||||
public static void AddGenes(Pawn pawn, List<GeneDef> genes)
|
||||
{
|
||||
foreach (GeneDef gene in genes)
|
||||
{
|
||||
pawn.genes.AddGene(gene, false);
|
||||
pawn.genes.AddGene(gene, RJW_BGSSettings.rjw_bgs_animal_genes_as_xenogenes);
|
||||
}
|
||||
}
|
||||
|
||||
//For ParchRJWHediffInsect_egg
|
||||
/// <summary>
|
||||
/// Initiates a bestiality baby with genes if the baby does not exist earlier.
|
||||
/// This is used to make rjw-egg-pregnancies work.
|
||||
/// Related file: PatchRJWHediffInsect_Egg.cs
|
||||
/// </summary>
|
||||
/// <param name="mother">The mother of the baby.</param>
|
||||
/// <param name="dad">The father of the baby.</param>
|
||||
/// <param name="baby">The baby created in non-pregnancy-way (has 0 Genes yet)</param>
|
||||
public static void NewGenes(Pawn mother, Pawn dad, Pawn baby)
|
||||
{
|
||||
if (!RJW_BGSSettings.enabled)
|
||||
if (!RJW_BGSSettings.rjw_bgs_enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ModLog.Message($"Triggering an New-Gene Animal-Gene-Inheritance for {baby.Name} ({dad.Name} + {mother.Name})");
|
||||
if (baby.RaceProps.Humanlike)
|
||||
{
|
||||
if (baby.genes == null)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace RJW_BGS
|
|||
[HarmonyPostfix]
|
||||
public static void AddGenes(Pawn mother, Pawn dad, ref Hediff_BasePregnancy __instance)
|
||||
{
|
||||
if (!RJW_BGSSettings.enabled)
|
||||
if (!RJW_BGSSettings.rjw_bgs_enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using rjw;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_BGS
|
||||
{
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using rjw;
|
||||
|
||||
namespace RJW_BGS
|
||||
{
|
||||
/// <summary>
|
||||
/// This Patch is applied to change the normal pregnancy to add animal-inheritance.
|
||||
/// If the settings allow animal gene inheritance,
|
||||
/// the genes are determined and "simply added".
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(PregnancyUtility), "GetInheritedGeneSet", new Type[]
|
||||
{
|
||||
typeof(Pawn),
|
||||
|
@ -22,7 +24,7 @@ namespace RJW_BGS
|
|||
[HarmonyPostfix]
|
||||
public static void AnimalInheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
|
||||
{
|
||||
if (!RJW_BGSSettings.enabled)
|
||||
if (!RJW_BGSSettings.rjw_bgs_enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,23 +21,31 @@ namespace RJW_BGS
|
|||
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("enabled", ref rjw_bgs_enabled, "If toggled, Animal Pregnancies will try inherit genes.", 0f, 1f);
|
||||
//listing_Standard.CheckboxLabeled("sexfrenzy", ref sexfrenzy, "disable the effects", 0f, 1f);
|
||||
listing_Standard.Gap(5f);
|
||||
listing_Standard.Label("gene inheritance chance"+ ": " +
|
||||
Math.Round((double)(RJW_BGSSettings.global_gene_chance * 100f), 0).ToString() + "%", -1f, "modify chance for a gene to be inherited.");
|
||||
RJW_BGSSettings.global_gene_chance = listing_Standard.Slider(RJW_BGSSettings.global_gene_chance, 0f, 5f);
|
||||
Math.Round((double)(RJW_BGSSettings.rjw_bgs_global_gene_chance * 100f), 0).ToString() + "%", -1f, "modify chance for a gene to be inherited.");
|
||||
RJW_BGSSettings.rjw_bgs_global_gene_chance = listing_Standard.Slider(RJW_BGSSettings.rjw_bgs_global_gene_chance, 0f, 5f);
|
||||
listing_Standard.Gap(5f);
|
||||
listing_Standard.CheckboxLabeled("genes as xenogenes", ref rjw_bgs_animal_genes_as_xenogenes, "If toggled, animal genes will be added as xenogenes.", 0f, 1f);
|
||||
listing_Standard.Gap(5f);
|
||||
listing_Standard.CheckboxLabeled("detailed-debug", ref rjw_bgs_detailed_debug, "Adds detailed information to the log about pregnancies and genes.", 0f, 1f);
|
||||
listing_Standard.End();
|
||||
}
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
base.ExposeData();
|
||||
Scribe_Values.Look<bool>(ref RJW_BGSSettings.enabled, "enabled", RJW_BGSSettings.enabled, true);
|
||||
Scribe_Values.Look<float>(ref RJW_BGSSettings.global_gene_chance, "global_gene_chance", RJW_BGSSettings.global_gene_chance, true);
|
||||
Scribe_Values.Look<bool>(ref RJW_BGSSettings.rjw_bgs_enabled, "rjw_bgs_enabled", RJW_BGSSettings.rjw_bgs_enabled, true);
|
||||
Scribe_Values.Look<float>(ref RJW_BGSSettings.rjw_bgs_global_gene_chance, "rjw_bgs_global_gene_chance", RJW_BGSSettings.rjw_bgs_global_gene_chance, true);
|
||||
Scribe_Values.Look<bool>(ref RJW_BGSSettings.rjw_bgs_animal_genes_as_xenogenes, "rjw_bgs_animal_genes_as_xenogenes", RJW_BGSSettings.rjw_bgs_animal_genes_as_xenogenes, true);
|
||||
Scribe_Values.Look<bool>(ref RJW_BGSSettings.rjw_bgs_detailed_debug, "rjw_bgs_detailed_debug", RJW_BGSSettings.rjw_bgs_detailed_debug, true);
|
||||
}
|
||||
|
||||
public static float global_gene_chance = 1f;
|
||||
public static bool enabled = true;
|
||||
public static float rjw_bgs_global_gene_chance = 1f;
|
||||
public static bool rjw_bgs_enabled = true;
|
||||
public static bool rjw_bgs_animal_genes_as_xenogenes = false;
|
||||
public static bool rjw_bgs_detailed_debug = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@ namespace RJW_BGS
|
|||
return result;
|
||||
}
|
||||
return null;
|
||||
//First check if there is a matching pawnkinddef then race, then racegroup
|
||||
|
||||
}
|
||||
|
||||
public static List<RaceGeneDef> ValidRaceGeneDefs(Pawn pawn)
|
||||
{
|
||||
PawnKindDef kindDef = pawn.kindDef;
|
||||
if (kindDef == null)
|
||||
{
|
||||
ModLog.Warning($"Error looking up PawnKindDef for {pawn.Name} - Could not lookup Animal Inheritance Genes");
|
||||
return null;
|
||||
}
|
||||
string raceName = kindDef.race.defName;
|
||||
|
@ -33,6 +33,9 @@ namespace RJW_BGS
|
|||
PawnData pawnData = SaveStorage.DataStore.GetPawnData(pawn);
|
||||
RaceGroupDef raceGroupDef = pawnData.RaceSupportDef;
|
||||
|
||||
if (RJW_BGSSettings.rjw_bgs_detailed_debug)
|
||||
ModLog.Message($"Looking up Animal-Inheritable Genes for {pawn.Name} with KindDef {kindDef.defName},RaceName {raceName}, PawnKind {pawnKindName} and RaceGroup {raceGroupDef.defName}");
|
||||
|
||||
IEnumerable<RaceGeneDef> allDefs = DefDatabase<RaceGeneDef>.AllDefs;
|
||||
List<RaceGeneDef> pawnKindDefs = allDefs.Where(delegate (RaceGeneDef group)
|
||||
{
|
||||
|
@ -40,7 +43,12 @@ namespace RJW_BGS
|
|||
return pawnKindNames != null && pawnKindNames.Contains(pawnKindName);
|
||||
}).ToList<RaceGeneDef>();
|
||||
if (pawnKindDefs.Count() > 0)
|
||||
{
|
||||
DebugPrintRaceGeneDefs("PawnKindDefs",pawn.Name.ToStringFull,pawnKindDefs);
|
||||
return pawnKindDefs;
|
||||
}
|
||||
else if (RJW_BGSSettings.rjw_bgs_detailed_debug)
|
||||
ModLog.Message($"Did not find PawnKindDefs for {pawn.Name.ToStringFull}");
|
||||
|
||||
List<RaceGeneDef> raceKindDefs = allDefs.Where(delegate (RaceGeneDef group)
|
||||
{
|
||||
|
@ -48,7 +56,12 @@ namespace RJW_BGS
|
|||
return raceNames != null && raceNames.Contains(raceName);
|
||||
}).ToList<RaceGeneDef>();
|
||||
if (raceKindDefs.Count() > 0)
|
||||
{
|
||||
DebugPrintRaceGeneDefs("PawnKindDefs", pawn.Name.ToStringFull, raceKindDefs);
|
||||
return raceKindDefs;
|
||||
}
|
||||
else if (RJW_BGSSettings.rjw_bgs_detailed_debug)
|
||||
ModLog.Message($"Did not find RaceKindDefs for {pawn.Name.ToStringFull}");
|
||||
|
||||
List<RaceGeneDef> raceGroupDefs = new List<RaceGeneDef>();
|
||||
if (raceGroupDef != null)
|
||||
|
@ -63,9 +76,27 @@ namespace RJW_BGS
|
|||
}
|
||||
|
||||
if (raceGroupDefs.Count() > 0)
|
||||
{
|
||||
DebugPrintRaceGeneDefs("RaceKindDefs", pawn.Name.ToStringFull, raceGroupDefs);
|
||||
return raceGroupDefs;
|
||||
}
|
||||
else if (RJW_BGSSettings.rjw_bgs_detailed_debug)
|
||||
ModLog.Message($"Did not find RaceGroupDefs for {pawn.Name.ToStringFull}");
|
||||
|
||||
ModLog.Message($"Did not find any Genes inheritable for {pawn.Name.ToStringFull}");
|
||||
return new List<RaceGeneDef>();
|
||||
}
|
||||
|
||||
private static void DebugPrintRaceGeneDefs(String header,String identifier,List<RaceGeneDef> defs)
|
||||
{
|
||||
if (RJW_BGSSettings.rjw_bgs_detailed_debug)
|
||||
{
|
||||
var defString = "[";
|
||||
foreach (RaceGeneDef raceGeneDef in defs)
|
||||
defString += $"({raceGeneDef.priority}:{raceGeneDef.defName} - {raceGeneDef.genes.Count} Genes)";
|
||||
defString += "]";
|
||||
ModLog.Message($"Found the following {header}-Genes for {identifier}: {defString}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Animal_Inheritance\First.cs" />
|
||||
<Compile Include="Animal_Inheritance\Harmony_Init.cs" />
|
||||
<Compile Include="Animal_Inheritance\InheritanceUtility.cs" />
|
||||
<Compile Include="Animal_Inheritance\PatchRJWBestialityPregnancyUtility.cs" />
|
||||
|
@ -71,6 +70,7 @@
|
|||
<Compile Include="Animal_Inheritance\RJW_BGSSettings.cs" />
|
||||
<Compile Include="Animal_Inheritance\RJW_BGSSettingsController.cs" />
|
||||
<Compile Include="Animal_Inheritance\BestialityGeneInheritanceDef.cs" />
|
||||
<Compile Include="Common\ModLog.cs" />
|
||||
<Compile Include="GeneDefOf.cs" />
|
||||
<Compile Include="Genes\Breeding\Gene_MechBreeder.cs" />
|
||||
<Compile Include="Genes\Breeding\PatchMechBirth.cs" />
|
||||
|
@ -82,6 +82,7 @@
|
|||
<Compile Include="Genes\Cum\Gene_MuchCum.cs" />
|
||||
<Compile Include="Genes\Cum\Gene_NoCum.cs" />
|
||||
<Compile Include="Genes\Cum\Patch_TransferNutrition.cs" />
|
||||
<Compile Include="Genes\Damage\Gene_Unbreakable.cs" />
|
||||
<Compile Include="Genes\Damage\Gene_Elasticity.cs" />
|
||||
<Compile Include="Genes\Cum\Patch_Cumflation.cs" />
|
||||
<Compile Include="Genes\ExtraGenitalia\Gene_ExtraBreasts.cs" />
|
||||
|
@ -98,6 +99,7 @@
|
|||
<Compile Include="Genes\Gender\Gene_MaleOnly.cs" />
|
||||
<Compile Include="Genes\GeneUtility.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\Gene_BigBreasts.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\Gene_GenitaliaResizingGene.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\Gene_LooseAnus.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\Gene_LooseFemaleGenitalia.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\Gene_TightAnus.cs" />
|
||||
|
@ -105,6 +107,7 @@
|
|||
<Compile Include="Genes\GenitaliaSize\Gene_TightFemaleGenitalia.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\Gene_SmallMaleGenitalia.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\Gene_BigMaleGenitalia.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\Patch_ResizingOnAdulthood.cs" />
|
||||
<Compile Include="Genes\GenitaliaSize\SizeAdjuster.cs" />
|
||||
<Compile Include="Genes\Genitalia\Gene_SlimeGenitalia.cs" />
|
||||
<Compile Include="Genes\Genitalia\Gene_DragonGenitalia.cs" />
|
||||
|
@ -117,7 +120,9 @@
|
|||
<Compile Include="Genes\RJW_Gene.cs" />
|
||||
<Compile Include="Genes\Genitalia\GenitaliaUtility.cs" />
|
||||
<Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones_.cs" />
|
||||
<Compile Include="Genes\Special\Patch_AgeDrain.cs" />
|
||||
<Compile Include="Genes\Special\Patch_OrgasmRush.cs" />
|
||||
<Compile Include="Genes\Special\Patch_Youth_Fountain.cs" />
|
||||
<Compile Include="HarmonyInit.cs" />
|
||||
<Compile Include="HediffDefOf.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
Loading…
Reference in a new issue