resplice patch

This commit is contained in:
Jaaldabaoth 2024-05-27 01:27:10 +02:00
parent 0617ea4995
commit 07a0ab0600
11 changed files with 227 additions and 12 deletions

Binary file not shown.

View File

@ -74,10 +74,11 @@ namespace RJW_Genes
public static readonly GeneDef rjw_genes_very_much_cum;
[MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_likes_cumflation;
[MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_cumflation_immunity;
[MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_generous_donor;
// Reproduction
public static readonly GeneDef rjw_genes_hypersexual;
[MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_generous_donor;
// Reproduction
public static readonly GeneDef rjw_genes_hypersexual;
public static readonly GeneDef rjw_genes_rapist;
public static readonly GeneDef rjw_genes_homosexual;
public static readonly GeneDef rjw_genes_bisexual;
@ -115,6 +116,9 @@ namespace RJW_Genes
public static readonly XenotypeDef rjw_genes_succubus;
public static readonly DutyDef rjw_genes_flirt;
public static readonly MentalBreakDef rjw_genes_lifeforce_randomrape;
[MayRequire("resplice.xotr.charmweavers")] public static GeneDef RS_LoveFeed = DefDatabase<GeneDef>.GetNamed("RS_LoveFeed", false);
[MayRequire("resplice.xotr.charmweavers")] public static GeneDef RS_MultiPregnancy = DefDatabase<GeneDef>.GetNamed("RS_MultiPregnancy", false);
[MayRequire("redmattis.bigsmall.core")] public static GeneDef VU_VampireLover = DefDatabase<GeneDef>.GetNamed("VU_VampireLover", false);

View File

@ -105,7 +105,7 @@ namespace RJW_Genes
{
return false;
}
return pawn.genes.HasGene(genedef);
return pawn.genes.HasActiveGene(genedef);
}
public static bool HasLifeForce(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_lifeforce); }

View File

@ -1,5 +1,4 @@
using Verse;
using Verse;
using RimWorld;
using rjw;
using System.Collections.Generic;

View File

@ -46,8 +46,8 @@ namespace RJW_Genes
{
if (cachedLifeForceGene.Resource.Value <= cachedLifeForceGene.Resource.MinLevelForAlert && this.Pawn.IsHashIntervalTick(2500) && Rand.Chance(0.03f)) //~50% chance each day for mental break
{
if (this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_cum_eater)
|| this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_fertilin_absorber) || this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_drainer))
if (this.Pawn.genes.HasActiveGene(GeneDefOf.rjw_genes_cum_eater)
|| this.Pawn.genes.HasActiveGene(GeneDefOf.rjw_genes_fertilin_absorber) || this.Pawn.genes.HasActiveGene(GeneDefOf.rjw_genes_drainer))
{
//TODO: use mentalstatedef instead of mentalbreakdef
MentalBreakDef randomrape = GeneDefOf.rjw_genes_lifeforce_randomrape;

View File

@ -27,7 +27,7 @@ namespace RJW_Genes
}
if (ModsConfig.IsActive("rjw.sexperience") && gene_lifeforce.StoredCumAllowed && genes.HasGene(GeneDefOf.rjw_genes_cum_eater))
if (ModsConfig.IsActive("rjw.sexperience") && gene_lifeforce.StoredCumAllowed && genes.HasActiveGene(GeneDefOf.rjw_genes_cum_eater))
{
Thing gatheredCum = this.GetStoredCum(pawn);
if (gatheredCum == null)

View File

@ -39,10 +39,10 @@ namespace RJW_Genes
List<GeneDef> absorption_genes_parents = new List<GeneDef>();
foreach (GeneDef geneDef in FertilinSourceGenes)
{
if(mother.genes != null && mother.genes.HasGene(geneDef))
if(mother.genes != null && mother.genes.HasActiveGene(geneDef))
absorption_genes_parents.Add(geneDef);
if (father.genes != null && father.genes.HasGene(geneDef))
if (father.genes != null && father.genes.HasActiveGene(geneDef))
absorption_genes_parents.Add(geneDef);
}
// Parents had Genes - Pick a random one of them

View File

@ -0,0 +1,122 @@
using RimWorld;
using rjw;
using Verse;
using System;
using RimWorld.Planet;
namespace RJWLoveFeeding
{
static class LustFeeding
{
//[HarmonyPostfix]
static Def LoveFeed = DefDatabase<GeneDef>.GetNamed("RS_LoveFeed", false);
static Def VampireLover = DefDatabase<GeneDef>.GetNamed("VU_VampireLover", false);
public static void Postfix(SexProps props)
{
try
{
LustFeeding.RJWLustFeeding(props);
}
catch (Exception e)
{
Log.Error(e.ToString());
}
}
public static void RJWLustFeeding(SexProps props)
{
if((props.pawn != null) && (props.partner != null) && !xxx.is_animal(props.pawn) && !xxx.is_animal(props.partner))
{
//ModLog.Message($" Patch Worked");
if(!props.pawn.IsCaravanMember() && !props.partner.IsCaravanMember())
{
RJWTryTakeBlood(props.pawn, props.partner);
RJWTryTakeBlood(props.partner, props.pawn);
}
}
}
public static bool RJWTryTakeBlood(Pawn pawn, Pawn bloodBag)
{
Pawn_GeneTracker genes = bloodBag.genes;
if ((genes.GetFirstGeneOfType<Gene_Hemogen>() != null))
{
return false;
}
genes = pawn.genes;
if (genes == null)
{
return false;
}
bool isLoveFeeder = false;
if(LoveFeed != null)
{
if (RJWSettings.DevMode) RJW_Genes.ModLog.Message("LoveFeed checks");
if (genes.HasActiveGene(RJW_Genes.GeneDefOf.RS_LoveFeed))
{
isLoveFeeder = true;
}
}
if (VampireLover != null)
{
if (RJWSettings.DevMode) RJW_Genes.ModLog.Message("LoveFeed checks");
if (genes.HasActiveGene(RJW_Genes.GeneDefOf.VU_VampireLover))
{
isLoveFeeder = true;
}
}
if (isLoveFeeder && (genes.GetFirstGeneOfType<Gene_Hemogen>() != null))
{
ModLog.Message($" Lovefeeder just finished loving: {xxx.get_pawnname(pawn)}");
Gene_Hemogen gene_Hemogen = genes.GetFirstGeneOfType<Gene_Hemogen>();
if (gene_Hemogen != null)
{
if (gene_Hemogen.Value < gene_Hemogen.targetValue)
{
Hediff bloodBagBloodLoss = bloodBag.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.BloodLoss, false);
if (bloodBagBloodLoss != null)
{
float afterBite = bloodBagBloodLoss.Severity + 0.25f;
if ((afterBite > HediffDefOf.BloodLoss.lethalSeverity) || (afterBite > 0.49f))
{
//ModLog.Message($"{xxx.get_pawnname(pawn)} would have killed someone. {afterBite} > {HediffDefOf.BloodLoss.lethalSeverity}");
return false;
}
}
SanguophageUtility.DoBite(pawn, bloodBag, 0.2f, 0.1f, 0.2f, 1f, IntRange.one, ThoughtDefOf.FedOn, ThoughtDefOf.FedOn_Social);
ModLog.Message($"{xxx.get_pawnname(pawn)} snacked on {xxx.get_pawnname(bloodBag)}");
return true;
}
else
{
ModLog.Message($"{xxx.get_pawnname(pawn)} not hungry. {gene_Hemogen.Value} > {gene_Hemogen.targetValue}");
}
}
}
return false; ;
}
}
}

View File

@ -0,0 +1,84 @@
using RimWorld;
using rjw;
using Verse;
using System.Linq;
using System.Collections.Generic;
using System;
using HarmonyLib;
using RJWLoveFeeding;
namespace RJWLoveFeeding
{
[HarmonyPatch(typeof(PawnExtensions), "IsPregnant", new Type[]
{
typeof(Pawn), typeof(bool)
})]
class MultiplePregnancies
{
static Def MultiPregnancy = DefDatabase<GeneDef>.GetNamed("RS_MultiPregnancy", false);
[HarmonyPostfix]
public static void Postfix(ref bool __result, Pawn pawn, bool mustBeVisible)
{
//Log.Message(xxx.get_pawnname(pawn) + " is in patch" + __result);
bool isPregnant = __result;
if (MultiPregnancy != null)
{
if (RJWSettings.DevMode) RJW_Genes.ModLog.Message("multipreg checks");
if (isPregnant)
{
try
{
isPregnant = MultiplePregnancies.RJWMultiplePregnancy(isPregnant, pawn);
//Log.Message(xxx.get_pawnname(pawn) + " is " + isPregnant);
}
catch (Exception e)
{
Log.Error(e.ToString());
}
}
__result = isPregnant;
}
}
public static bool RJWMultiplePregnancy(bool isPregnant, Pawn fucked)
{
if ((fucked != null) && !xxx.is_animal(fucked))
{
List<Hediff> set = fucked.health.hediffSet.hediffs;
//Taking all hediffs that prevent pregnancy but are are not of the type used for pregnancies itself
List<Hediff> setNoPreggo = set.FindAll(o => (o.def.preventsPregnancy) && !(o is HediffWithParents));
if (setNoPreggo.NullOrEmpty())
{
//Log.Message("No other hediffs preventing pregnancy");
Pawn_GeneTracker genes = fucked.genes;
if (genes.HasActiveGene(RJW_Genes.GeneDefOf.RS_MultiPregnancy))
{
Log.Message(xxx.get_pawnname(fucked) + " has multipregnancy gene");
return false;
}
else
{
//Log.Message(xxx.get_pawnname(fucked) + " has NOT multipreg gene");
}
}
else
{
Log.Message(setNoPreggo.First<Hediff>().def.defName + ": This prevents pregnancy");
}
}
return isPregnant;
}
}
}

View File

@ -2,6 +2,7 @@
using HarmonyLib;
using System;
using rjw;
using RJWLoveFeeding;
namespace RJW_Genes
{
@ -16,7 +17,10 @@ namespace RJW_Genes
harmony.Unpatch(original, HarmonyPatchType.Prefix, "rjw");
harmony.PatchAll();
if (ModsConfig.BiotechActive)
{
harmony.Patch(typeof(SexUtility).GetMethod("ProcessSex"), new HarmonyMethod(typeof(LustFeeding), "Postfix", null));
}
// Patch Licentia, if Licentia exists
// Logic & Explanation taken from https://rimworldwiki.com/wiki/Modding_Tutorials/Compatibility_with_DLLs

View File

@ -146,6 +146,8 @@
<Compile Include="Genes\Life_Force\ThinkNodes\ThinkNode_NewFlirtTarget.cs" />
<Compile Include="Genes\Life_Force\UI\Alert_LowFertilin.cs" />
<Compile Include="Genes\Life_Force\UI\GeneGizmo_ResourceLifeForce.cs" />
<Compile Include="Genes\Patches\LustFeeding.cs" />
<Compile Include="Genes\Patches\MultiplePregnancies.cs" />
<Compile Include="Genes\Patch_AddNotifyOnGeneration.cs" />
<Compile Include="Genes\Genital_Helper_2.cs" />
<Compile Include="Genes\Special\Defs\AgeTransferExtension.cs" />