mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Added Elasticity Gene and Zoophile Trait Gene
This commit is contained in:
parent
f17da08394
commit
84c0ab012e
15 changed files with 227 additions and 19 deletions
|
@ -17,7 +17,7 @@ namespace RJW_Genes
|
|||
{
|
||||
if (!__result)
|
||||
{
|
||||
__result = GeneUtility.isInsectBreeder(pawn);
|
||||
__result = GeneUtility.IsInsectBreeder(pawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
38
Source/Genes/Cum/Patch_Cumflation.cs
Normal file
38
Source/Genes/Cum/Patch_Cumflation.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
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;
|
||||
using LicentiaLabs;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
/// <summary>
|
||||
/// Changes LicentiaLabs (if Present) to not cumflate pawns that are cumflation immune.
|
||||
/// This code is exercised / loaded in the HarmonyInit.
|
||||
/// </summary>
|
||||
///
|
||||
class Patch_Cumflation
|
||||
{
|
||||
// This patch does not need the normal Harmony Targetting,
|
||||
// as it needs to be added only on demand (See HarmonyInit.cs)
|
||||
public static bool Prefix(SexProps props)
|
||||
{
|
||||
// Harmony Logic skips the original Method after Prefix when "false" is returned
|
||||
// See https://harmony.pardeike.net/articles/execution.html
|
||||
|
||||
// We skip the whole Cumflation Logic when the Partner is Cumflation Immune
|
||||
if (props != null && props.partner != null && GeneUtility.IsCumflationImmune(props.partner))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
35
Source/Genes/Damage/Gene_Elasticity.cs
Normal file
35
Source/Genes/Damage/Gene_Elasticity.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using LicentiaLabs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
/// <summary>
|
||||
/// This Gene adds Licentia-Labs Elasticised Hediff to a Pawn.
|
||||
/// Important: I had a HarmonyPatch first, similar to skipping cumflation, but the Stretching Logic is called quite a lot and for both pawns actually.
|
||||
/// Hence, I think choosing the Elasticiced Hediff was good as then everything is covered by "Licentia-Logic".
|
||||
/// </summary>
|
||||
public class Gene_Elasticity : Gene
|
||||
{
|
||||
|
||||
public override void PostAdd()
|
||||
{
|
||||
base.PostAdd();
|
||||
this.pawn.health.AddHediff(Licentia.HediffDefs.Elasticised);
|
||||
}
|
||||
|
||||
public override void PostRemove()
|
||||
{
|
||||
Hediff candidate = pawn.health.hediffSet.GetFirstHediffOfDef(Licentia.HediffDefs.Elasticised);
|
||||
if (candidate != null)
|
||||
{
|
||||
pawn.health.RemoveHediff(candidate);
|
||||
}
|
||||
base.PostRemove();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using Verse;
|
||||
using System;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
|
@ -22,7 +23,7 @@ namespace RJW_Genes
|
|||
return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator);
|
||||
}
|
||||
|
||||
public static bool isInsectBreeder(Pawn pawn)
|
||||
public static bool IsInsectBreeder(Pawn pawn)
|
||||
{
|
||||
if (pawn.genes == null)
|
||||
{
|
||||
|
@ -40,5 +41,23 @@ namespace RJW_Genes
|
|||
}
|
||||
return MaxEggSize;
|
||||
}
|
||||
|
||||
internal static bool IsElastic(Pawn pawn)
|
||||
{
|
||||
if (pawn.genes == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return pawn.genes.HasGene(GeneDefOf.rjw_genes_elasticity);
|
||||
}
|
||||
|
||||
public static bool IsCumflationImmune(Pawn pawn)
|
||||
{
|
||||
if (pawn.genes == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return pawn.genes.HasGene(GeneDefOf.rjw_genes_cumflation_immunity);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue