Added Settings for RJW Genes, minor Cleanups

This commit is contained in:
Vegapnk 2023-01-22 09:59:16 +01:00
parent 31e96bd5e3
commit d6aeca7249
11 changed files with 115 additions and 45 deletions

View File

@ -12,6 +12,7 @@ Features:
- RJW Race-Support Compatibility (#12,#13, Shabakur) - RJW Race-Support Compatibility (#12,#13, Shabakur)
- Animal Gene Inheritance Gene-Chance Multiplier per Setting (#13, Shabakur) - Animal Gene Inheritance Gene-Chance Multiplier per Setting (#13, Shabakur)
- Lots of Debug-Only Logging for Animal Gene Inheritance - Lots of Debug-Only Logging for Animal Gene Inheritance
- Mod-Settings
Succubus: Succubus:
@ -22,6 +23,7 @@ Fixes:
- Futa Gene only triggers if Pawn is not a futa already (#2) - Futa Gene only triggers if Pawn is not a futa already (#2)
- Genitalia Resizing triggers on 20th Birthday (#11) - Genitalia Resizing triggers on 20th Birthday (#11)
- RJW-Gene-Inheritance Settings now do things (#13, Shabakur) - RJW-Gene-Inheritance Settings now do things (#13, Shabakur)
- Check for Animals in Orgasm Rush, no Orgasm Rush for and from Animals (#15)
# 1.0.1 (2022-12-20) # 1.0.1 (2022-12-20)

View File

@ -11,7 +11,7 @@
<JobDef> <JobDef>
<defName>rjw_genes_lifeforce_healpussy</defName> <defName>rjw_genes_lifeforce_healpussy</defName>
<driverClass>RJW_Genes.JobDriver_CastAbilityAfterSex</driverClass> <driverClass>RJW_Genes.JobDriver_CastAbilityAfterSex</driverClass>
<reportString>Healing someone with sex.</reportString> <reportString>Tending someones wounds with sex.</reportString>
<casualInterruptible>false</casualInterruptible> <casualInterruptible>false</casualInterruptible>
</JobDef> </JobDef>

View File

@ -38,6 +38,7 @@ namespace RJW_Genes
} }
} }
public static bool HasLowLifeForce(Pawn pawn) public static bool HasLowLifeForce(Pawn pawn)
{ {
if (HasLifeForce(pawn)) if (HasLifeForce(pawn))
@ -118,5 +119,7 @@ namespace RJW_Genes
public static bool HasParalysingKiss(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_paralysingkiss); } 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 HasSeduce(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_seduce); }
public static bool IsSexualDrainer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_drainer); } public static bool IsSexualDrainer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_drainer); }
public static bool IsCumEater(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_cum_eater); }
} }
} }

View File

@ -1,13 +1,7 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse; using Verse;
using UnityEngine;
using RimWorld; using RimWorld;
using rjw; using rjw;
using rjw.Modules.Interactions.Helpers;
namespace RJW_Genes namespace RJW_Genes
{ {
@ -31,11 +25,8 @@ namespace RJW_Genes
bool any_wound_tended = AbilityUtility.Heal(pawn, this.Props.tendQualityRange); bool any_wound_tended = AbilityUtility.Heal(pawn, this.Props.tendQualityRange);
if (any_wound_tended) if (any_wound_tended)
{ {
MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, "Sex healed wounds", 3.65f); MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, "Sex tended wounds", 3.65f);
//pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.Pussy_Healed, pawn, null);
} }
//this.AfterSex(any_wound_tended);
//FleckMaker.AttachedOverlay(pawn, FleckDefOf.FlashHollow, Vector3.zero, 1.5f, -1f);
} }
//Not yet implemented, but the heal should also trigger after normal sex //Not yet implemented, but the heal should also trigger after normal sex
@ -77,7 +68,7 @@ namespace RJW_Genes
} }
return false; return false;
} }
//AbilityUtility.ValidateHasTendableWound(pawn, throwMessages, this.parent); //TODO: Only make pawns targetable that have tendable wounds
} }
return base.Valid(target, throwMessages); return base.Valid(target, throwMessages);

View File

@ -39,7 +39,7 @@ namespace RJW_Genes
{ {
return null; return null;
} }
int num = Mathf.RoundToInt(((gene_lifeforce.targetValue - gene_lifeforce.Value) * 100 + 10) / ingestionOutcomeDoer.FERTILIN_PER_UNIT); int num = Mathf.RoundToInt(((gene_lifeforce.targetValue - gene_lifeforce.Value) * 100 + 10) / IngestionOutcomeDoer_LifeForceOffset.FERTILIN_PER_UNIT);
if (gatheredCum != null && num > 0) if (gatheredCum != null && num > 0)
{ {
Job job = JobMaker.MakeJob(RimWorld.JobDefOf.Ingest, gatheredCum); Job job = JobMaker.MakeJob(RimWorld.JobDefOf.Ingest, gatheredCum);

View File

@ -103,6 +103,12 @@ namespace RJW_Genes
multiplier *= absorb_percentage; multiplier *= absorb_percentage;
//Currently taking the sum of all penises, maybe I should just consider one at random //Currently taking the sum of all penises, maybe I should just consider one at random
float valuechange = TotalFertilinAmount(props, multiplier); float valuechange = TotalFertilinAmount(props, multiplier);
if (props.partner.IsAnimal())
{
valuechange *= RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor;
}
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange); GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange);
//gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier; //gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier;
} }
@ -129,7 +135,7 @@ namespace RJW_Genes
/// </summary> /// </summary>
/// <param name="props">The summary of the sex act, used for checking conditions.</param> /// <param name="props">The summary of the sex act, used for checking conditions.</param>
/// <param name="PawnWithLifeForce">The pawn that might gain LifeForce through this method.</param> /// <param name="PawnWithLifeForce">The pawn that might gain LifeForce through this method.</param>
/// <returns></returns> /// <returns>A factor between 0 and 1 how much of output-fertilin will be used for input-lifeforce</returns>
public static float BaseDom(SexProps props, Pawn PawnWithLifeForce) public static float BaseDom(SexProps props, Pawn PawnWithLifeForce)
{ {
float absorb_factor = 0f; float absorb_factor = 0f;
@ -145,7 +151,7 @@ namespace RJW_Genes
/// </summary> /// </summary>
/// <param name="props">The summary of the sex act, used for checking conditions.</param> /// <param name="props">The summary of the sex act, used for checking conditions.</param>
/// <param name="PawnWithLifeForce">The pawn that might gain LifeForce through this method.</param> /// <param name="PawnWithLifeForce">The pawn that might gain LifeForce through this method.</param>
/// <returns></returns> /// <returns>A factor between 0 and 1 how much of output-fertilin will be used for input-lifeforce</returns>
public static float BaseSub(SexProps props, Pawn PawnWithLifeForce) public static float BaseSub(SexProps props, Pawn PawnWithLifeForce)
{ {
float absorb_factor = 0f; float absorb_factor = 0f;

View File

@ -11,47 +11,52 @@ using Verse;
namespace RJW_Genes namespace RJW_Genes
{ {
//[HarmonyPatch(typeof(JobDriver_Sex), nameof(JobDriver_Sex.ChangePsyfocus))] /// <summary>
/// This patch enables cum-eater pawns to drain cumflations for more fertilin drain by passively having sex.
/// It is hooked after RJWs Change-Psyfocus so that pawns that are having prolonged sex (e.g. by overdrive) can fully drain the cumflation over time.
///
/// It is conditionally loaded only when LicentiaLabs is enabled, as this is the necessary source for cumflation-hediffs.
/// The patched function is: [HarmonyPatch(typeof(JobDriver_Sex), nameof(JobDriver_Sex.ChangePsyfocus))]
/// </summary>
public static class Patch_SexTicks_ChangePsyfocus public static class Patch_SexTicks_ChangePsyfocus
{ {
public const float LIFEFORCE_GAIN_PER_TICK = 0.05f;
public const float CUMFLATION_SEVERITY_LOSS_PER_TICK = 0.1f;
//Using ChangePsyfocus as it is something that fires every 60 ticks //Using ChangePsyfocus as it is something that fires every 60 ticks
public static void Postfix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target) public static void Postfix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target)
{ {
if (__instance.Sexprops.sexType == xxx.rjwSextype.Cunnilingus) SexProps props = __instance.Sexprops;
{ if (props != null && props.sexType == xxx.rjwSextype.Cunnilingus && props.partner != null && target != null)
if (target != null) {
{ Pawn pawn2 = target as Pawn;
Pawn pawn2 = target as Pawn; // Case 1: Pawn is "drinking" and has CumEater Gene
if (pawn2 != null) if (props.isRevese && GeneUtility.IsCumEater(pawn))
{ {
//We need to know who the pawn on top is and if reverse we need to make the sub the pawn on top if (RJW_Genes_Settings.rjw_genes_detailed_debug)
if (__instance.Sexprops.isRevese) ModLog.Message($"{pawn.Name} is draining {pawn2.Name}'s cumflation for additional fertilin (CumEater-Gene ChangePsyFocus-Trigger).");
{ DrinkCumflation(pawn2, pawn);
}
DrinkCumflation(pawn2, pawn); // Case 2: Pawn2 is "drinking" and has CumEater Gene
} else if (GeneUtility.IsCumEater(pawn2))
else {
{ if (RJW_Genes_Settings.rjw_genes_detailed_debug)
// ModLog.Message($"{pawn.Name} is draining {pawn2.Name}'s cumflation for additional fertilin (CumEater-Gene ChangePsyFocus-Trigger).");
DrinkCumflation(pawn, pawn2); DrinkCumflation(pawn, pawn2);
return;
}
}
} }
} }
} }
public static void DrinkCumflation(Pawn dom, Pawn sub) public static void DrinkCumflation(Pawn source, Pawn consumer)
{ {
if (GeneUtility.HasLifeForce(sub) && GeneUtility.HasGeneNullCheck(sub,GeneDefOf.rjw_genes_cum_eater)&& dom.health.hediffSet.HasHediff(HediffDef.Named("Cumflation"))) if (GeneUtility.HasLifeForce(consumer) && GeneUtility.IsCumEater(consumer)
&& source.health.hediffSet.HasHediff(HediffDef.Named("Cumflation")))
{ {
Hediff cumflation = dom.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation")); Hediff cumflation = source.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation"));
Gene_LifeForce gene_LifeForce = sub.genes.GetFirstGeneOfType<Gene_LifeForce>(); Gene_LifeForce gene_LifeForce = consumer.genes.GetFirstGeneOfType<Gene_LifeForce>();
cumflation.Severity -= 0.1f; cumflation.Severity = Math.Max(0f,cumflation.Severity - CUMFLATION_SEVERITY_LOSS_PER_TICK);
gene_LifeForce.Resource.Value += 0.05f; gene_LifeForce.Resource.Value += LIFEFORCE_GAIN_PER_TICK;
} }
} }
//Maybe I can store gene and hediff so I dont need to look them up every time
} }
} }

View File

@ -27,6 +27,7 @@ namespace RJW_Genes
// Gene: Generous Donor [Postfix Patch] // Gene: Generous Donor [Postfix Patch]
harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.TransferNutrition)), harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.TransferNutrition)),
postfix: new HarmonyMethod(typeof(Patch_TransferNutrition), nameof(Patch_TransferNutrition.Postfix))); postfix: new HarmonyMethod(typeof(Patch_TransferNutrition), nameof(Patch_TransferNutrition.Postfix)));
// Gene: CumEater [Postfix Patch]
harmony.Patch(AccessTools.Method(typeof(rjw.JobDriver_Sex), nameof(rjw.JobDriver_Sex.ChangePsyfocus)), harmony.Patch(AccessTools.Method(typeof(rjw.JobDriver_Sex), nameof(rjw.JobDriver_Sex.ChangePsyfocus)),
postfix: new HarmonyMethod(typeof(Patch_SexTicks_ChangePsyfocus), nameof(Patch_SexTicks_ChangePsyfocus.Postfix))); postfix: new HarmonyMethod(typeof(Patch_SexTicks_ChangePsyfocus), nameof(Patch_SexTicks_ChangePsyfocus.Postfix)));
} }

View File

@ -175,6 +175,8 @@
<Compile Include="JobDefOf.cs" /> <Compile Include="JobDefOf.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RJW_Genes.cs" /> <Compile Include="RJW_Genes.cs" />
<Compile Include="Settings\RJW_Genes_Settings.cs" />
<Compile Include="Settings\RJW_Genes_SettingsController.cs" />
<Compile Include="ThoughtDefOf.cs" /> <Compile Include="ThoughtDefOf.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,38 @@
using System;
using Verse;
using UnityEngine;
namespace RJW_Genes
{
public class RJW_Genes_Settings : ModSettings
{
public static void DoWindowContents(Rect inRect)
{
//Copied from RJW settings mostly
Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f);
Rect rect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + 300f);
//Widgets.BeginScrollView(outRect, ref RJWSettings.scrollPosition, rect, true);
Listing_Standard listing_Standard = new Listing_Standard();
listing_Standard.maxOneColumn = true;
listing_Standard.ColumnWidth = rect.width / 2.05f;
listing_Standard.Begin(rect);
listing_Standard.Gap(24f);
listing_Standard.Label("Fertlin-Gain from Animals" + ": " +
Math.Round((double)(RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor * 100f), 0).ToString() + "%", -1f, "of fertilin gained (compared to human-baseline).");
RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor = listing_Standard.Slider(RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, 0f, 3f);
listing_Standard.Gap(5f);
listing_Standard.CheckboxLabeled("detailed-debug", ref rjw_genes_detailed_debug, "Adds detailed information to the log about interactions and genes.", 0f, 1f);
listing_Standard.End();
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look<float>(ref RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, "rjw_genes_fertilin_from_animals_factor", RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, true);
Scribe_Values.Look<bool>(ref RJW_Genes_Settings.rjw_genes_detailed_debug, "rjw_genes_detailed_debug", RJW_Genes_Settings.rjw_genes_detailed_debug, true);
}
public static bool rjw_genes_detailed_debug = false;
public static float rjw_genes_fertilin_from_animals_factor = 0.1f;
}
}

View File

@ -0,0 +1,22 @@
using Verse;
using UnityEngine;
namespace RJW_Genes
{
public class RJW_Genes_SettingsController : Mod
{
public RJW_Genes_SettingsController(ModContentPack content) : base(content)
{
base.GetSettings<RJW_Genes_Settings>();
}
public override string SettingsCategory()
{
return "RJW Genes - General";
}
public override void DoSettingsWindowContents(Rect inRect)
{
RJW_Genes_Settings.DoWindowContents(inRect);
}
}
}