Unified Cum-Genes and made them configurable

This commit is contained in:
Vegapnk 2024-07-08 18:54:37 +02:00
parent 7339bd41a1
commit 832c3aa0b8
8 changed files with 66 additions and 90 deletions

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class MultiplierExtension : DefModExtension
{
public float multiplier;
}
}

View file

@ -34,8 +34,23 @@ namespace RJW_Genes
}
//Get total fluidamount a person has.
public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f)
/// <summary>
/// Looks up the "MultiplierExtensions" Value for a given Gene, with a fall back.
/// Returns the fallback if there is no Extension, or if the Multiplier is smaller than 0.
/// </summary>
public static float LookupCumMultiplier(Gene gene, float FALLBACK = 3.0f) => LookupCumMultiplier(gene.def,FALLBACK);
public static float LookupCumMultiplier(GeneDef def, float FALLBACK = 3.0f)
{
MultiplierExtension multiplier = def.GetModExtension<MultiplierExtension>();
if (multiplier == null || multiplier.multiplier < 0)
return FALLBACK;
else return multiplier.multiplier;
}
//Get total fluidamount a person has.
public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f)
{
var partBPR = Genital_Helper.get_genitalsBPR(pawn);
var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR);

View file

@ -1,36 +1,38 @@
namespace RJW_Genes
{
public class Gene_MuchCum : RJW_Gene
public class Gene_ChangeCumAmount : RJW_Gene
{
bool has_been_fired = false;
float multiplier_much_cum = 3f;
public override void PostMake()
{
base.PostMake();
CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum);
float multipier = CumUtility.LookupCumMultiplier(this);
CumUtility.MultiplyFluidAmountBy(pawn, multipier);
has_been_fired = true;
}
public override void PostAdd()
{
base.PostAdd();
if (!has_been_fired) {
CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum);
if (!has_been_fired)
{
float multipier = CumUtility.LookupCumMultiplier(this);
CumUtility.MultiplyFluidAmountBy(pawn, multipier);
has_been_fired = true;
}
}
public override void PostRemove()
{
base.PostAdd();
if (has_been_fired)
{
CumUtility.MultiplyFluidAmountBy(pawn, 1/multiplier_much_cum);
float multipier = CumUtility.LookupCumMultiplier(this);
CumUtility.MultiplyFluidAmountBy(pawn, 1/ multipier);
has_been_fired = false;
}
}

View file

@ -1,34 +0,0 @@
namespace RJW_Genes
{
public class Gene_NoCum : RJW_Gene
{
bool has_been_fired = false;
public override void PostMake()
{
base.PostMake();
CumUtility.MultiplyFluidAmountBy(pawn, 0f);
has_been_fired = true;
}
public override void PostAdd()
{
base.PostAdd();
if (!has_been_fired) {
CumUtility.MultiplyFluidAmountBy(pawn, 0f);
has_been_fired = true;
}
}
public override void PostRemove()
{
// Cum Removal does not do at the moment :/ I would need to safe the old cum amount but I don't want to at the moment
base.PostAdd();
}
}
}

View file

@ -1,39 +0,0 @@
namespace RJW_Genes
{
public class Gene_VeryMuchCum : RJW_Gene
{
bool has_been_fired = false;
float multiplier_much_cum = 10f;
public override void PostMake()
{
base.PostMake();
CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum);
has_been_fired = true;
}
public override void PostAdd()
{
base.PostAdd();
if (!has_been_fired) {
CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum);
has_been_fired = true;
}
}
public override void PostRemove()
{
base.PostAdd();
if (has_been_fired)
{
CumUtility.MultiplyFluidAmountBy(pawn, 1/multiplier_much_cum);
has_been_fired = false;
}
}
}
}

View file

@ -59,6 +59,7 @@
<Compile Include="Common\Defs\ChanceExtension.cs" />
<Compile Include="Common\Defs\DistanceExtension.cs" />
<Compile Include="Common\Defs\ModExtensionHelper.cs" />
<Compile Include="Common\Defs\MultiplierExtension.cs" />
<Compile Include="Common\Defs\TickBasedChanceExtension.cs" />
<Compile Include="Common\Either.cs" />
<Compile Include="Common\Helpers\FactionUtility.cs" />
@ -105,9 +106,7 @@
<Compile Include="Genes\Gender\Genes\Gene_GenderFluid.cs" />
<Compile Include="Genes\GenitaliaSize\Gene_EvergrowingGenitalia.cs" />
<Compile Include="Genes\Cum\CumUtility.cs" />
<Compile Include="Genes\Cum\Gene_VeryMuchCum.cs" />
<Compile Include="Genes\Cum\Gene_MuchCum.cs" />
<Compile Include="Genes\Cum\Gene_NoCum.cs" />
<Compile Include="Genes\Cum\Gene_ChangeCumAmount.cs" />
<Compile Include="Genes\Cum\Patch_TransferNutrition.cs" />
<Compile Include="Genes\Damage\Gene_Unbreakable.cs" />
<Compile Include="Genes\Cum\Patch_CumflationImmunity.cs" />