Compare commits

...

4 commits

Author SHA1 Message Date
Vegapnk
a72dc01d73 Renamings and Sorting things around 2023-01-20 08:55:21 +01:00
Vegapnk
7220accf4a Merge Cumeater and follow up changes 2023-01-20 08:40:09 +01:00
Vegapnk
8d3eeda0bf Seduce only works against pawns without Seduce 2023-01-17 09:08:56 +01:00
Vegapnk
f2871744fd Minor Cleanups and Renamings, prefixed all defs with rjw_genes_ 2023-01-17 08:56:26 +01:00
10 changed files with 62 additions and 145 deletions

View file

@ -5,7 +5,6 @@
<randomChosen>true</randomChosen> <randomChosen>true</randomChosen>
<exclusionTags> <exclusionTags>
<li>Wing</li> <li>Wing</li>
<li>Wings</li>
</exclusionTags> </exclusionTags>
<graphicData> <graphicData>
<drawLoc>Tailbone</drawLoc> <drawLoc>Tailbone</drawLoc>

View file

@ -85,6 +85,8 @@ namespace RJW_Genes
public static readonly GeneDef rjw_genes_vaginal_absorber; public static readonly GeneDef rjw_genes_vaginal_absorber;
public static readonly GeneDef rjw_genes_anal_absorber; public static readonly GeneDef rjw_genes_anal_absorber;
public static readonly GeneDef rjw_genes_drainer; public static readonly GeneDef rjw_genes_drainer;
public static readonly GeneDef rjw_genes_seduce;
public static readonly GeneDef rjw_genes_paralysingkiss;
// Cosmetic // Cosmetic
public static readonly GeneDef rjw_genes_succubus_tail; public static readonly GeneDef rjw_genes_succubus_tail;
@ -96,4 +98,5 @@ namespace RJW_Genes
public static readonly MentalBreakDef rjw_genes_lifeforce_randomrape; public static readonly MentalBreakDef rjw_genes_lifeforce_randomrape;
} }
} }

View file

@ -6,16 +6,7 @@ namespace RJW_Genes
{ {
public class GeneUtility public class GeneUtility
{ {
//Instead of seperate functions this should be simpeler
public static bool HasGeneNullCheck(Pawn pawn, GeneDef genedef)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(genedef);
}
//Split function so I can offsetlifeforce from gene without needing to look for the gene agian (for the constant drain tick) //Split function so I can offsetlifeforce from gene without needing to look for the gene agian (for the constant drain tick)
public static Gene_LifeForce GetLifeForceGene(Pawn pawn) public static Gene_LifeForce GetLifeForceGene(Pawn pawn)
{ {
@ -35,10 +26,11 @@ namespace RJW_Genes
{ {
if (old_value > 0.2f && drain.Resource.Value <= 0.2f) if (old_value > 0.2f && drain.Resource.Value <= 0.2f)
{ {
//Mood debuff //TODO: Mood debuff
} }
else if (old_value > 0f && drain.Resource.Value <= 0f) else if (old_value > 0f && drain.Resource.Value <= 0f)
{ {
Pawn pawn = drain.Pawn;
if (!drain.Pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_fertilin_craving)) if (!drain.Pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_fertilin_craving))
{ {
drain.Pawn.health.AddHediff(HediffDefOf.rjw_genes_fertilin_craving); drain.Pawn.health.AddHediff(HediffDefOf.rjw_genes_fertilin_craving);
@ -46,24 +38,6 @@ namespace RJW_Genes
} }
} }
public static bool IsMechbreeder(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_mechbreeder);
}
public static bool HasLifeForce(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_lifeforce);
}
public static bool HasLowLifeForce(Pawn pawn) public static bool HasLowLifeForce(Pawn pawn)
{ {
if (HasLifeForce(pawn)) if (HasLifeForce(pawn))
@ -90,42 +64,6 @@ namespace RJW_Genes
return false; return false;
} }
public static bool IsInsectIncubator(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator);
}
public static bool IsYouthFountain(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_youth_fountain);
}
public static bool IsAgeDrainer(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_sex_age_drain);
}
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) public static float MaxEggSizeMul(Pawn pawn)
{ {
float MaxEggSize = 1; float MaxEggSize = 1;
@ -135,51 +73,6 @@ namespace RJW_Genes
} }
return MaxEggSize; 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);
}
public static bool IsGenerousDonor(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_generous_donor);
}
public static bool isPussyHealer(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_pussyhealing);
}
public static bool IsUnbreakable(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_unbreakable);
}
public static List<Gene_GenitaliaResizingGene> GetGenitaliaResizingGenes(Pawn pawn) public static List<Gene_GenitaliaResizingGene> GetGenitaliaResizingGenes(Pawn pawn)
{ {
var ResizingGenes = new List<Gene_GenitaliaResizingGene>(); var ResizingGenes = new List<Gene_GenitaliaResizingGene>();
@ -194,5 +87,36 @@ namespace RJW_Genes
return ResizingGenes; return ResizingGenes;
} }
/// <summary>
/// Unified small check for a pawn if it has a specified Gene.
/// Handles some errors and returns false as default.
/// </summary>
/// <param name="pawn">The pawn for which to look up a gene.</param>
/// <param name="genedef">The gene to look up.</param>
/// <returns></returns>
public static bool HasGeneNullCheck(Pawn pawn, GeneDef genedef)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(genedef);
}
public static bool HasLifeForce(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_lifeforce); }
public static bool IsMechbreeder(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_mechbreeder); }
public static bool IsInsectIncubator(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_insectincubator); }
public static bool IsYouthFountain(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_youth_fountain); }
public static bool IsAgeDrainer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_sex_age_drain); }
public static bool IsInsectBreeder(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_insectbreeder); }
public static bool IsElastic(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_elasticity); }
public static bool IsCumflationImmune(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_cumflation_immunity); }
public static bool IsGenerousDonor(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_generous_donor); }
public static bool IsPussyHealer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_pussyhealing); }
public static bool IsUnbreakable(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_unbreakable); }
public static bool HasParalysingKiss(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_paralysingkiss); }
public static bool HasSeduce(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_seduce); }
public static bool IsSexualDrainer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_drainer); }
} }
} }

View file

@ -23,11 +23,11 @@ namespace RJW_Genes
FloatRange tendQualityRange; FloatRange tendQualityRange;
tendQualityRange.min = 0.4f; tendQualityRange.min = 0.4f;
tendQualityRange.max = 0.8f; tendQualityRange.max = 0.8f;
if (GeneUtility.isPussyHealer(pawn)) if (GeneUtility.IsPussyHealer(pawn))
{ {
Heal(partner, tendQualityRange); Heal(partner, tendQualityRange);
} }
if (GeneUtility.isPussyHealer(partner)) if (GeneUtility.IsPussyHealer(partner))
{ {
Heal(pawn, tendQualityRange); Heal(pawn, tendQualityRange);
} }

View file

@ -1,9 +1,4 @@
using System; using Verse;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using Verse;
using Verse.AI; using Verse.AI;
using RimWorld; using RimWorld;
namespace RJW_Genes namespace RJW_Genes

View file

@ -54,6 +54,14 @@ namespace RJW_Genes
Messages.Message("bestiality is disabled", pawn, MessageTypeDefOf.RejectInput, false); Messages.Message("bestiality is disabled", pawn, MessageTypeDefOf.RejectInput, false);
} }
return false; return false;
}
else if (GeneUtility.HasSeduce(pawn))
{
if (throwMessages)
{
Messages.Message(pawn.Name + " cannot be seduced, as they also have the Seduce-Ability", pawn, MessageTypeDefOf.RejectInput, false);
}
return false;
} }
else if (pawn.Downed) else if (pawn.Downed)
{ {

View file

@ -1,10 +1,4 @@
using HarmonyLib; using System.Collections.Generic;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse; using Verse;
using RimWorld; using RimWorld;
@ -13,13 +7,13 @@ namespace RJW_Genes
public class Gene_Aphrodisiac_Pheromones : Gene public class Gene_Aphrodisiac_Pheromones : Gene
{ {
//Summary once every one hour check for all pawns nearby and in line of sight (same room) and add/renew a hediff which lasts for 1 hour. // Summary: once every one hour check for all pawns nearby and in line of sight (same room) and add/renew a hediff which lasts for 1 hour.
public override void Tick() public override void Tick()
{ {
base.Tick(); base.Tick();
if (this.pawn.IsHashIntervalTick(2500) && this.pawn.Map != null) if (this.pawn.IsHashIntervalTick(2500) && this.pawn.Map != null)
{ {
//Only spread pheromones if sexdrive above 1 // Only spread pheromones if sexdrive above 1
float sexfrequency = this.pawn.GetStatValue(StatDef.Named("SexFrequency")); float sexfrequency = this.pawn.GetStatValue(StatDef.Named("SexFrequency"));
if(sexfrequency > 1f) if(sexfrequency > 1f)
{ {
@ -31,21 +25,23 @@ namespace RJW_Genes
} }
} }
//Creatus an IEnumerable of all pawns which are closeby and in lineofsight, self and other pawns with aphrodisiac pheromones gene are skipped (to prevent loops). // Creates an IEnumerable of all pawns which are closeby and in lineofsight, self and other pawns with aphrodisiac pheromones gene are skipped (to prevent loops).
private IEnumerable<Pawn> AffectedPawns(IntVec3 pos, Map map) private IEnumerable<Pawn> AffectedPawns(IntVec3 pos, Map map)
{ {
foreach (Pawn pawn in map.mapPawns.AllPawns) foreach (Pawn pawn in map.mapPawns.AllPawns)
{ {
if (pawn != null && this.pawn != null && pawn != this.pawn && pos.DistanceTo(pawn.Position) < 5 && GenSight.LineOfSight(pos, pawn.Position, pawn.Map) && !GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones)) if (pawn != null && this.pawn != null && pawn != this.pawn
&& pos.DistanceTo(pawn.Position) < 5 && GenSight.LineOfSight(pos, pawn.Position, pawn.Map)
&& !GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
{ {
yield return pawn; yield return pawn;
} }
} }
//IEnumerator<Pawn> enumerator = null;
yield break; yield break;
} }
//Applies or renews a hediff which increases sexdrive for 1 hours // Applies or renews a hediff which increases sexdrive for 6 hours
private void InduceAphrodisiac(Pawn pawn, float sexfrequency) private void InduceAphrodisiac(Pawn pawn, float sexfrequency)
{ {
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_aphrodisiac_pheromone); Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_aphrodisiac_pheromone);
@ -68,7 +64,7 @@ namespace RJW_Genes
} }
} }
//Function to modify aphrodisiac strength, currently has no effect, but it's an easy hook for other modders. // Function to modify aphrodisiac strength, currently has no effect, but provides an easy hook for other modders and patches.
public float ModifySexfrequency(Pawn pawn, float sexfrequency) public float ModifySexfrequency(Pawn pawn, float sexfrequency)
{ {
return sexfrequency; return sexfrequency;

View file

@ -1,17 +1,9 @@
using System; using Verse;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using rjw.Modules.Interactions; using rjw.Modules.Interactions;
using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Internals.Implementation;
using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects;
using rjw;
using rjw.Modules.Interactions.Enums;
//Modefied code based of RJW-AI code at https://gitgud.io/Ed86/rjw-ia/-/tree/master/ //Modified code based of RJW-AI code at https://gitgud.io/Ed86/rjw-ia/-/tree/master/
namespace RJW_Genes namespace RJW_Genes
{ {
[StaticConstructorOnStartup] [StaticConstructorOnStartup]
@ -25,7 +17,6 @@ namespace RJW_Genes
} }
} }
static SubSuccubusTailCustomRequirementHandler() static SubSuccubusTailCustomRequirementHandler()
{ {
Register(); Register();
@ -50,3 +41,4 @@ namespace RJW_Genes
//public static readonly StringListDef filter = DefDatabase<StringListDef>.GetNamed("SubSuccubusTailFilter"); //public static readonly StringListDef filter = DefDatabase<StringListDef>.GetNamed("SubSuccubusTailFilter");
} }
} }

View file

@ -162,7 +162,7 @@
<Compile Include="Genes\Life_Force\Gene_LifeForce.cs" /> <Compile Include="Genes\Life_Force\Gene_LifeForce.cs" />
<Compile Include="Genes\RJW_Gene.cs" /> <Compile Include="Genes\RJW_Gene.cs" />
<Compile Include="Genes\Genitalia\GenitaliaUtility.cs" /> <Compile Include="Genes\Genitalia\GenitaliaUtility.cs" />
<Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones_.cs" /> <Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones.cs" />
<Compile Include="Genes\Life_Force\Patch_LifeForce.cs" /> <Compile Include="Genes\Life_Force\Patch_LifeForce.cs" />
<Compile Include="Genes\Special\Patch_OrgasmRush.cs" /> <Compile Include="Genes\Special\Patch_OrgasmRush.cs" />
<Compile Include="Genes\Special\Patch_Youth_Fountain.cs" /> <Compile Include="Genes\Special\Patch_Youth_Fountain.cs" />