settings, random genitalia selectio

This commit is contained in:
Jaaldabaoth 2024-05-29 13:00:55 +02:00
parent 25614f42ae
commit 95b48cc008
17 changed files with 74 additions and 142 deletions

View file

@ -1,35 +0,0 @@
using Verse;
namespace RJW_Genes
{
public static class RJW_GenesLogger
{
public static void Message(string message)
{
Log.Message("[INFO][RJW_Genes] - " + message);
}
public static void Warning(string message)
{
Log.Message("[WARN][RJW_Genes] - " + message);
}
public static void Error(string message)
{
Log.Message("[ ERR][RJW_Genes] - " + message);
}
public static void MessageGroupHead(string message)
{
Log.Message("[INFO][RJW_Genes]╦═ " + message);
}
public static void MessageGroupBody(string message)
{
Log.Message("[INFO][RJW_Genes]╠═══ " + message);
}
public static void MessageGroupFoot(string message)
{
Log.Message("[INFO][RJW_Genes]╚═══ " + message);
}
}
}

View file

@ -7,7 +7,7 @@ using HarmonyLib;
using RimWorld;
using Verse;
using rjw;
using LewdBiotech;
namespace RJW_Genes
{
@ -24,16 +24,16 @@ namespace RJW_Genes
{
if (rapist.health.hediffSet.HasHediff(HediffDef.Named("LimbicStimulator")))
{
if (LBTSettings.devMode)
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
{
RJW_GenesLogger.MessageGroupHead("Found LimbicStimulator hediff during xxx.would_rape check");
RJW_GenesLogger.MessageGroupBody("Pawn: " + rapist.NameShortColored + " (" + rapist.ThingID + ")");
RJW_GenesLogger.MessageGroupBody("__result (Before roll): " + __result);
ModLog.Message("Found LimbicStimulator hediff during xxx.would_rape check");
ModLog.Message("Pawn: " + rapist.NameShortColored + " (" + rapist.ThingID + ")");
ModLog.Message("__result (Before roll): " + __result);
}
__result = Rand.Chance(0.95f);
if (LBTSettings.devMode)
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
{
RJW_GenesLogger.MessageGroupFoot("__result (After roll): " + __result);
ModLog.Message("__result (After roll): " + __result);
}
}
}
@ -42,9 +42,9 @@ namespace RJW_Genes
{
if (pawn.health.hediffSet.HasHediff(HediffDef.Named("LimbicStimulator")))
{
if (LBTSettings.devMode)
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
{
RJW_GenesLogger.Message("Found LimbicStimulator hediff during xxx.is_rapist check for " + pawn.NameShortColored + " (" + pawn.ThingID + ")" + " with __result = " + __result + " - forcing to true");
ModLog.Message("Found LimbicStimulator hediff during xxx.is_rapist check for " + pawn.NameShortColored + " (" + pawn.ThingID + ")" + " with __result = " + __result + " - forcing to true");
__result = true;
}
}
@ -52,7 +52,7 @@ namespace RJW_Genes
static public void think_about_sex_Rapist_PostFix(ref ThoughtDef __result, Pawn pawn)
{
if (LBTSettings.regretStealingLovinThoughtDisabled) return;
if (RJW_Genes_Settings.regretStealingLovinThoughtDisabled) return;
if (pawn.health.hediffSet.HasHediff(HediffDef.Named("LimbicStimulator")) && (__result == stoleSomeLovin || __result == bloodlustStoleSomeLovin) && !pawn.story.traits.HasTrait(rapist) && !pawn.story.traits.HasTrait(sadist))
{

View file

@ -33,6 +33,7 @@ namespace RJW_Genes
public static readonly GeneDef rjw_genes_Orc_genitalia;
public static readonly GeneDef rjw_genes_Pig_genitalia;
public static readonly GeneDef rjw_genes_Tentacle_genitalia;
public static readonly GeneDef rjw_genes_human_genitalia;
// Extra Genitalia
public static readonly GeneDef rjw_genes_extra_penis;

View file

@ -14,6 +14,9 @@ namespace RJW_Genes
public static HediffDef GhostPenis = HediffDef.Named("GhostPenis");
public static HediffDef NecroPenis = HediffDef.Named("NecroPenis");
public static HediffDef GhostVagina = HediffDef.Named("GhostVagina");
public static HediffDef Vagina = HediffDef.Named("Vagina");
public static HediffDef Penis = HediffDef.Named("Penis");
public static HediffDef Anus = HediffDef.Named("Anus");
}
}

View file

@ -8,7 +8,7 @@ namespace RJW_Genes
public override void PostMake()
{
base.PostMake();
Apply();
}
public override void PostAdd()
@ -19,13 +19,16 @@ namespace RJW_Genes
protected virtual void Apply()
{
GenitaliaTypeExtension genitals = def.GetModExtension<GenitaliaTypeExtension>();
if (genitals == null && RJW_Genes_Settings.rjw_genes_detailed_debug)
if (this.Active)
{
ModLog.Error($"Gene {def} failed to change genitals - Need a modExtension with Class=\"{typeof(GenitaliaTypeExtension).FullName}\".");
return;
GenitaliaTypeExtension genitals = def.GetModExtension<GenitaliaTypeExtension>();
if (genitals == null && RJW_Genes_Settings.rjw_genes_detailed_debug)
{
ModLog.Error($"Gene {def} failed to change genitals - Need a modExtension with Class=\"{typeof(GenitaliaTypeExtension).FullName}\".");
return;
}
GenitaliaChanger.ChangeGenitalia(pawn, genitals.penis, genitals.vagina, genitals.anus);
}
GenitaliaChanger.ChangeGenitalia(pawn, genitals.penis, genitals.vagina, genitals.anus);
}
}
}

View file

@ -61,7 +61,7 @@ namespace RJW_Genes
case "rjw_genes_udder_breasts": return Genital_Helper.udder_breasts;
case "rjw_genes_ovipositor_genitalia": return Genital_Helper.average_breasts;
default: return Genital_Helper.generic_breasts;
default: return Genital_Helper.average_breasts;
}
}

View file

@ -9,22 +9,15 @@ namespace RJW_Genes
public class Gene_EvergrowingGenitalia : RJW_Gene
{
/// <summary>
/// The age (in years) at which the Pawns Genes will take effect, resizing their genitalia.
/// </summary>
public const int RESIZING_AGE = 20;
//public const int GROWTH_INTERVAL = 1000; // Test value for Quick Trials
public const int GROWTH_INTERVAL_FALLBACK = 60000; // 60k == 1 day
public override void Tick()
{
base.Tick();
int interval = ModExtensionHelper.GetTickIntervalFromModExtension(GeneDefOf.rjw_genes_evergrowth, GROWTH_INTERVAL_FALLBACK);
int interval = ModExtensionHelper.GetTickIntervalFromModExtension(GeneDefOf.rjw_genes_evergrowth, RJW_Genes_Settings.rjw_genes_evergrowth_ticks);
if (pawn.IsHashIntervalTick(interval)
&& this.pawn.Map != null
&& pawn.ageTracker.AgeBiologicalYears >= RESIZING_AGE)
&& pawn.ageTracker.AgeBiologicalYears >= RJW_Genes_Settings.rjw_genes_resizing_age)
{
GrowPenisses();
GrowVaginas();

View file

@ -7,7 +7,6 @@ using HarmonyLib;
using RimWorld;
using Verse;
using rjw;
using LewdBiotech;
namespace RJW_Genes
{
@ -33,11 +32,11 @@ namespace RJW_Genes
// with littered births gene, move on
if (!laborStateIsNull && hasLitteredBirthsGene)
{
if (LBTSettings.devMode)
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
{
RJW_GenesLogger.MessageGroupHead("Found active LaborState and LitteredBirths gene - skipping additional Hediff_Labor_PostRemovedPostFix work");
RJW_GenesLogger.MessageGroupBody("Pawn: " + __instance.pawn.NameShortColored + " (" + __instance.pawn.ThingID + ")");
RJW_GenesLogger.MessageGroupFoot("birthCount: " + laborStateMap.TryGetValue(__instance.pawn.ThingID).birthCount);
ModLog.Message("Found active LaborState and LitteredBirths gene - skipping additional Hediff_Labor_PostRemovedPostFix work");
ModLog.Message("Pawn: " + __instance.pawn.NameShortColored + " (" + __instance.pawn.ThingID + ")");
ModLog.Message("birthCount: " + laborStateMap.TryGetValue(__instance.pawn.ThingID).birthCount);
}
return;
@ -46,7 +45,7 @@ namespace RJW_Genes
// Make a new LaborState for the null case with littered births
if (laborStateIsNull && hasLitteredBirthsGene)
{
RJW_GenesLogger.Message("Found littered births gene");
ModLog.Message("Found littered births gene");
int litteredBirthsTotalRoll = Rand.RangeInclusive(2, 4);
laborStateMap.SetOrAdd(__instance.pawn.ThingID, new LaborState(__instance.pawn, litteredBirthsTotalRoll));
return;
@ -56,9 +55,9 @@ namespace RJW_Genes
// pawns that don't already have state, so return if state is !null (STATE SHOULD ALWAYS BE CLEANED IN LABORPUSHING POSTFIX)
if (!laborStateIsNull)
{
if (LBTSettings.devMode)
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
{
RJW_GenesLogger.Warning("Labor state for pawn " + __instance.pawn.NameShortColored + " (" + __instance.pawn.ThingID + ") is not null despite all checks passing for determining first instance of Hediff_Labor - this warning should never occur, and may indicate a bug in Hediff_LaborPushing of lingering labor state from a previous pregnancy");
ModLog.Warning("Labor state for pawn " + __instance.pawn.NameShortColored + " (" + __instance.pawn.ThingID + ") is not null despite all checks passing for determining first instance of Hediff_Labor - this warning should never occur, and may indicate a bug in Hediff_LaborPushing of lingering labor state from a previous pregnancy");
}
return;
}
@ -77,12 +76,12 @@ namespace RJW_Genes
if (!randomTwinsRoll && !hasAgitator)
{
// We failed rolls, and we don't have an agitator - no additional processing, do vanilla single baby birth
if (LBTSettings.devMode)
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
{
RJW_GenesLogger.MessageGroupHead("Inside Hediff_Labor_PostRemovedPostFix random twins check fail");
RJW_GenesLogger.MessageGroupBody("Pawn: " + __instance.pawn.NameShortColored);
RJW_GenesLogger.MessageGroupBody("Random twins roll outcome: " + randomTwinsRoll);
RJW_GenesLogger.MessageGroupFoot("Has OvaryAgitator: " + hasAgitator);
ModLog.Message("Inside Hediff_Labor_PostRemovedPostFix random twins check fail");
ModLog.Message("Pawn: " + __instance.pawn.NameShortColored);
ModLog.Message("Random twins roll outcome: " + randomTwinsRoll);
ModLog.Message("Has OvaryAgitator: " + hasAgitator);
}
return;
}
@ -134,9 +133,9 @@ namespace RJW_Genes
if (!hasAgitator && !hasLitteredBirthsGene)
{
if (LBTSettings.devMode)
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
{
RJW_GenesLogger.Message("Pawn " + __instance.pawn.NameShortColored + " (" + __instance.pawn.ThingID + ") is having random twins");
ModLog.Message("Pawn " + __instance.pawn.NameShortColored + " (" + __instance.pawn.ThingID + ") is having random twins");
}
Find.LetterStack.ReceiveLetter("Twins!", __instance.pawn.NameShortColored + " is still in labor and is having twins!\n\nBe sure to gather your doctor and additional friends and family to ensure the other baby is also born healthy!", LetterDefOf.AnotherBaby, __instance.pawn);
return;

View file

@ -43,11 +43,10 @@
<Compile Include="Common\Defs\ModExtensionHelper.cs" />
<Compile Include="Common\Either.cs" />
<Compile Include="Common\Helpers\LaborState.cs" />
<Compile Include="Common\Helpers\RJW_GenesLogger.cs" />
<Compile Include="Common\ModLog.cs" />
<Compile Include="Common\Defs\TickIntervalExtension.cs" />
<Compile Include="Common\Patches\PatchImplants.cs" />
<Compile Include="Common\Patches\PatchLitteredBirth.cs" />
<Compile Include="Genes\Patches\PatchLitteredBirth.cs" />
<Compile Include="Common\Patches\PatchGetParents.cs" />
<Compile Include="Common\Patches\PatchPregnancyHelper.cs" />
<Compile Include="GeneDefOf.cs" />
@ -157,7 +156,6 @@
<Compile Include="JobDefOf.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RJW_Genes.cs" />
<Compile Include="Settings\LBTSettings.cs" />
<Compile Include="Settings\RJW_Genes_Settings.cs" />
<Compile Include="Settings\RJW_Genes_SettingsController.cs" />
<Compile Include="ThoughtDefOf.cs" />

View file

@ -1,54 +0,0 @@
using UnityEngine;
using Verse;
// If it isn't blatantly obvious, I unabashedly ripped this settings template from RJW, minus the fact that
// I won't be (personally) supporting multiplayer, and it's all in one file - but I digress ...
namespace LewdBiotech
{
class LBTSettingsController : Mod
{
public LBTSettingsController(ModContentPack content) : base(content)
{
GetSettings<LBTSettings>();
}
public override string SettingsCategory()
{
return "LBTSettings".Translate();
}
public override void DoSettingsWindowContents(Rect inRect)
{
LBTSettings.DoWindowContents(inRect);
}
}
public class LBTSettings : ModSettings
{
// For my own sanity, all now and future settings will have a default disabled/false state (at least, that's the plan), and
// the settings name and description should reflect that (not that I'm going to add that many settings, mind you)
public static bool devMode = false;
public static bool regretStealingLovinThoughtDisabled = false;
public static void DoWindowContents(Rect inRect)
{
// Shrink the settings window a bit - don't need to be that w i d e
inRect.width = inRect.width - 400;
inRect.x = inRect.x + 200;
Listing_Standard listingStandard = new Listing_Standard();
listingStandard.Begin(inRect);
listingStandard.Gap(4f);
listingStandard.CheckboxLabeled("EnableLBTDevLogging".Translate(), ref devMode, "EnableLBTDevLoggingDesc".Translate());
listingStandard.Gap(4f);
listingStandard.CheckboxLabeled("RegretStealingLovinThoughtDisabled".Translate(), ref regretStealingLovinThoughtDisabled, "RegretStealingLovinThoughtDisabledDesc".Translate());
listingStandard.End();
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref devMode, "EnableLBTDevLogging", devMode, true);
Scribe_Values.Look(ref regretStealingLovinThoughtDisabled, "regretStealingLovinThoughtDisabled", regretStealingLovinThoughtDisabled, true);
}
}
}

View file

@ -21,12 +21,22 @@ namespace RJW_Genes
listing_Standard.Label("Genitalia resizing age" + ": " +
Math.Round((double)(RJW_Genes_Settings.rjw_genes_resizing_age), 0).ToString() , -1f, "years.");
RJW_Genes_Settings.rjw_genes_resizing_age = listing_Standard.Slider(RJW_Genes_Settings.rjw_genes_resizing_age, 18f, 100f);
listing_Standard.Gap(4f);
listing_Standard.Label("Fertilin-Gain from Animals" + ": " +
Math.Round((double)(RJW_Genes_Settings.rjw_genes_evergrowth_ticks), 0).ToString() , -1f, "ticks.");
RJW_Genes_Settings.rjw_genes_evergrowth_ticks = (int) listing_Standard.Slider(RJW_Genes_Settings.rjw_genes_evergrowth_ticks, 600, 60000);
listing_Standard.Gap(4f);
listing_Standard.Label("nunmber of ticks between genitalia evergrowth updates (600 tick for ~2cm/day)" + ": " +
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(4f);
listing_Standard.CheckboxLabeled("RegretStealingLovinThoughtDisabled".Translate(), ref regretStealingLovinThoughtDisabled, "RegretStealingLovinThoughtDisabledDesc".Translate());
listing_Standard.Gap(5f);
listing_Standard.CheckboxLabeled("generous-donor cheatmode", ref rjw_genes_generous_donor_cheatmode, "When enabled, pawns with the 'generous donor' are not drained and not fertilin exhausted. Hence they can fuel succubi and incubi non-stop. This makes them drastically easier to keep, and you should not do it.", 0f, 1f);
@ -38,16 +48,20 @@ namespace RJW_Genes
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look<int>(ref RJW_Genes_Settings.rjw_genes_evergrowth_ticks, "rjw_genes_evergrowth_ticks", RJW_Genes_Settings.rjw_genes_evergrowth_ticks, true);
Scribe_Values.Look<float>(ref RJW_Genes_Settings.rjw_genes_resizing_age, "rjw_genes_resizing_age", RJW_Genes_Settings.rjw_genes_resizing_age, true);
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);
Scribe_Values.Look(ref regretStealingLovinThoughtDisabled, "regretStealingLovinThoughtDisabled", regretStealingLovinThoughtDisabled, true);
Scribe_Values.Look<bool>(ref RJW_Genes_Settings.rjw_genes_generous_donor_cheatmode, "rjw_genes_generous_donor_cheatmode", RJW_Genes_Settings.rjw_genes_generous_donor_cheatmode, true);
}
public static bool rjw_genes_detailed_debug = false;
public static float rjw_genes_fertilin_from_animals_factor = 0.1f;
public static float rjw_genes_resizing_age = 20;
public static int rjw_genes_evergrowth_ticks = 60000;
public static bool regretStealingLovinThoughtDisabled = false;