Added insectbreeder gene

This commit is contained in:
Shabakur 2022-11-18 14:23:12 +01:00
parent 04ca72ec78
commit ba8bd9605b
8 changed files with 48 additions and 0 deletions

View File

@ -18,4 +18,13 @@
<displayOrderInCategory>52</displayOrderInCategory>
<displayCategory>Reproduction</displayCategory>
</GeneDef>
<GeneDef>
<defName>rjw_genes_insectbreeder</defName>
<label>InsectBreeder</label>
<description>Pawns with this gene are able to fertilize eggs with any fertile penis.</description>
<iconPath>World/WorldObjects/Expanding/Mechanoids</iconPath>
<displayOrderInCategory>53</displayOrderInCategory>
<displayCategory>Reproduction</displayCategory>
</GeneDef>
</Defs>

View File

@ -13,5 +13,6 @@ namespace shabe_genesaddons
{
public static readonly GeneDef rjw_genes_mechbreeder;
public static readonly GeneDef rjw_genes_insectincubator;
public static readonly GeneDef rjw_genes_insectbreeder;
}
}

View File

@ -27,6 +27,15 @@ namespace shabe_genesaddons
return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator);
}
public static bool isInsectBreeder(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectbreeder);
}
public static float MaxEggSizeMul(Pawn pawn)
{
float MaxEggSize = 1;

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using rjw;
using Verse;
using RimWorld;
namespace shabe_genesaddons
{
[HarmonyPatch(typeof(PawnExtensions), "RaceImplantEggs")]
public static class PatchPawnExtensions
{
[HarmonyPostfix]
public static void Postfix(Pawn pawn, ref bool __result)
{
if (!__result)
{
__result = GeneUtility.isInsectBreeder(pawn);
}
}
}
}

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@ -60,6 +60,7 @@
<Compile Include="GeneDefOf.cs" />
<Compile Include="HarmonyInit.cs" />
<Compile Include="PatchMechBirth.cs" />
<Compile Include="PatchPawnExtensions.cs" />
<Compile Include="PatchPregnancyHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="GeneUtility.cs" />