Compare commits

..

6 commits

Author SHA1 Message Date
Vegapnk
b6147dfb82 Updated some docs 2024-07-03 12:33:57 +02:00
Vegapnk
aadf7795c0 Added a simple genetic disease that resets the sex need to 0.1 2024-07-03 12:18:17 +02:00
Vegapnk
b56c0105a6 Moved the GenderFluid Logic to be more generic 2024-07-03 11:41:24 +02:00
Vegapnk
38f2470b90 Fleshed out some simple disease genes 2024-07-03 10:54:00 +02:00
Vegapnk
c90c9e2c02 Removed the DiseaseGene 2024-07-03 10:20:57 +02:00
Vegapnk
bccd258d13 Disease Spread uses settings 2024-07-03 10:14:05 +02:00
15 changed files with 330 additions and 87 deletions

View file

@ -1,3 +1,37 @@
# 2.2.0
**Genetic Diseases**
This update introduces genetic diseases that are shared on sex.
Infection is handled when sex finishes, so a coitus-interruptus will not result in infections.
Infections can be
- Turned off entirely
- Spread only on penetrative sex
- Chances are adjustable per XML per Gene
By turning their spread off, you effectively have a set of normal negative genes.
*Why???*
Most of the genes so far were positive or neutral,
so I got some fair requests to introduce negative genes to keep xenotypes balanced.
I know that this is some overlap with the STD mod, but well ... you are free to turn things off?
**Additions**
- Passive Gene: *Genetic Disease Immunity* - cannot get infected by any genetic diseases, and won't be affected by some other genes (see relevant genes)
- Disease Gene: Vulnerability. Pawn is likelier to be raped
- Disease Gene: Infectious Hypersexuality
- Disease Gene: Infectious Homosexuality & Bisexuality
- Disease Gene: Fluctual Sexual Need. (Configurable) Chance to reset sex-need to near-zero and gain a bit of rest-need.
**Internal**
- GenderFluid-Gene now uses a generalized `TickBasedChanceExtension` over its unique special `GenderFluidExtension`
- Introduced a `ModLog.Debug` Function that checks for the settings before printing - trying to spread it over the whole project.
# 2.1.0
**Additions**:

View file

@ -1,49 +1,189 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<GeneDef>
<displayCategory>rjw_genes_diseases</displayCategory>
<defName>rjw_genes_genetic_disease_immunity</defName>
<displayOrderInCategory>1</displayOrderInCategory>
<label>genetic disease immunity</label>
<description>This gene makes the pawn immune against genetic STDs and other genes that imply negative side-effects. </description>
<biostatCpx>2</biostatCpx>
<biostatMet>-1</biostatMet>
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
<li MayRequire="OskarPotocki.VanillaFactionsExpanded.Core"
Class="VanillaGenesExpanded.GeneExtension">
<backgroundPathEndogenes>Genes/Icons/RJW_Genes_Endogene_Background</backgroundPathEndogenes>
<backgroundPathXenogenes>Genes/Icons/RJW_Genes_Xenogene_Background</backgroundPathXenogenes>
</li>
</GeneDef>
<GeneDef>
<displayCategory>rjw_genes_diseases</displayCategory>
<defName>rjw_genes_minor_vulnerability</defName>
<geneClass>RJW_Genes.DiseaseGene</geneClass>
<label>minor vulnerability</label>
<description>This gene makes the pawn more vulnerable, and a more attractive target for rape. </description>
<biostatCpx>2</biostatCpx>
<biostatMet>-1</biostatMet>
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
<displayOrderInCategory>3</displayOrderInCategory>
<GeneDef Name="RJWGeneDisease" Abstract="True">
<displayCategory>rjw_genes_diseases</displayCategory>
<randomChosen>false</randomChosen>
<modExtensions>
<li MayRequire="OskarPotocki.VanillaFactionsExpanded.Core"
Class="VanillaGenesExpanded.GeneExtension">
<backgroundPathEndogenes>Genes/Icons/RJW_Genes_Endogene_Background</backgroundPathEndogenes>
<backgroundPathXenogenes>Genes/Icons/RJW_Genes_Xenogene_Background</backgroundPathXenogenes>
</li>
<li Class="RJW_Genes.GeneticDiseaseExtension">
<infectionChance>1.0</infectionChance>
</modExtensions>
</GeneDef>
<GeneDef>
<displayCategory>rjw_genes_diseases</displayCategory>
<defName>rjw_genes_genetic_disease_immunity</defName>
<displayOrderInCategory>1</displayOrderInCategory>
<marketValueFactor>0.95</marketValueFactor>
<label>genetic disease immunity</label>
<description>This gene makes the pawn immune against genetic STDs and some other genes that
imply negative side-effects.</description>
<biostatCpx>1</biostatCpx>
<biostatMet>-1</biostatMet>
<iconPath>UI/Icons/Rituals/TrialDefend</iconPath>
<modExtensions>
<li MayRequire="OskarPotocki.VanillaFactionsExpanded.Core"
Class="VanillaGenesExpanded.GeneExtension">
<backgroundPathEndogenes>Genes/Icons/RJW_Genes_Endogene_Background</backgroundPathEndogenes>
<backgroundPathXenogenes>Genes/Icons/RJW_Genes_Xenogene_Background</backgroundPathXenogenes>
</li>
</modExtensions>
</GeneDef>
</GeneDef>
<GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_minor_vulnerability</defName>
<label>minor vulnerability</label>
<description>This gene makes the pawn a bit more vulnerable, and a slightly more attractive
target for rape.</description>
<biostatCpx>1</biostatCpx>
<biostatMet>1</biostatMet>
<marketValueFactor>0.85</marketValueFactor>
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
<displayOrderInCategory>5</displayOrderInCategory>
<statOffsets>
<Vulnerability>0.15</Vulnerability>
</statOffsets>
<exclusionTags>
<li>RJW_Genes_Vulnerability</li>
</exclusionTags>
<modExtensions>
<li Class="RJW_Genes.GeneticDiseaseExtension">
<infectionChance>0.05</infectionChance>
</li>
</modExtensions>
</GeneDef>
<GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_major_vulnerability</defName>
<label>major vulnerability</label>
<description>This gene makes the pawn more vulnerable, and a more attractive target for
rape.</description>
<biostatCpx>2</biostatCpx>
<biostatMet>1</biostatMet>
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
<displayOrderInCategory>6</displayOrderInCategory>
<exclusionTags>
<li>RJW_Genes_Vulnerability</li>
</exclusionTags>
<statOffsets>
<Vulnerability>0.3</Vulnerability>
</statOffsets>
<modExtensions>
<li Class="RJW_Genes.GeneticDiseaseExtension">
<infectionChance>0.03</infectionChance>
</li>
</modExtensions>
</GeneDef>
<GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_infectious_hypersexuality</defName>
<label>infectious hypersexuality</label>
<description>This gene makes the pawn hypersexual, and has a chance to spread on
intercourse.</description>
<iconPath>Genes/Icons/Hypersexual</iconPath>
<biostatCpx>2</biostatCpx>
<biostatMet>2</biostatMet>
<displayOrderInCategory>7</displayOrderInCategory>
<exclusionTags>
<li>rjw_genes_hypersexuality_trait_giver</li>
</exclusionTags>
<forcedTraits>
<li>
<def>Nymphomaniac</def>
</li>
</forcedTraits>
<modExtensions>
<li Class="RJW_Genes.GeneticDiseaseExtension">
<infectionChance>0.05</infectionChance>
</li>
</modExtensions>
</GeneDef>
<GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_infectious_bisexuality</defName>
<label>infectious bisexuality</label>
<description>This gene makes the pawn bisexual, and has a chance to spread on intercourse.</description>
<iconPath>UI\Ideoligions\Universal\RoundC</iconPath>
<biostatCpx>1</biostatCpx>
<biostatMet>0</biostatMet>
<displayOrderInCategory>8</displayOrderInCategory>
<exclusionTags>
<li>rjw_genes_bisexuality_trait_giver</li>
<li>rjw_genes_sexual_orientation</li>
</exclusionTags>
<forcedTraits>
<li>
<def>Bisexual</def>
</li>
</forcedTraits>
<modExtensions>
<li Class="RJW_Genes.GeneticDiseaseExtension">
<infectionChance>0.1</infectionChance>
</li>
</modExtensions>
</GeneDef>
<GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_infectious_homosexuality</defName>
<label>infectious homosexuality</label>
<description>This gene makes the pawn homosexual, and has a chance to spread on intercourse.</description>
<iconPath>UI\Ideoligions\Universal\RoundC</iconPath>
<biostatCpx>1</biostatCpx>
<biostatMet>0</biostatMet>
<displayOrderInCategory>9</displayOrderInCategory>
<exclusionTags>
<li>rjw_genes_homosexuality_trait_giver</li>
<li>rjw_genes_sexual_orientation</li>
</exclusionTags>
<forcedTraits>
<li>
<def>Gay</def>
</li>
</forcedTraits>
<modExtensions>
<li Class="RJW_Genes.GeneticDiseaseExtension">
<infectionChance>0.1</infectionChance>
</li>
</modExtensions>
</GeneDef>
<GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_fluctual_sexual_needs</defName>
<label>fluctual sexual needs</label>
<description>Carriers of this genetic disease have a chance to suddenly require sex, gaining a bit of energy to find quick relief.</description>
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
<biostatCpx>1</biostatCpx>
<biostatMet>2</biostatMet>
<displayOrderInCategory>11</displayOrderInCategory>
<geneClass>RJW_Genes.Gene_FluctualSexualNeed</geneClass>
<modExtensions>
<li Class="RJW_Genes.GeneticDiseaseExtension">
<infectionChance>0.1</infectionChance>
</li>
<li Class="RJW_Genes.TickBasedChanceExtension">
<!-- 30k = 1/2 days -->
<tickInterval>30000</tickInterval>
<eventChance>0.15</eventChance>
</li>
</modExtensions>
</GeneDef>
</Defs>

View file

@ -14,6 +14,10 @@
</li>
</forcedTraits>
<exclusionTags>
<li>rjw_genes_hypersexuality_trait_giver</li>
</exclusionTags>
<randomChosen>false</randomChosen>
<modExtensions>
<li MayRequire="OskarPotocki.VanillaFactionsExpanded.Core"
@ -111,6 +115,8 @@
</li>
</forcedTraits>
<exclusionTags>
<li>rjw_genes_homosexuality_trait_giver</li>
<li>rjw_genes_sexual_orientation</li>
</exclusionTags>
@ -138,7 +144,8 @@
</li>
</forcedTraits>
<exclusionTags>
<li>rjw_genes_sexual_orientation</li>
<li>rjw_genes_sexual_orientation</li>
<li>rjw_genes_bisexuality_trait_giver</li>
</exclusionTags>
<randomChosen>false</randomChosen>

View file

@ -65,10 +65,10 @@
<backgroundPathEndogenes>Genes/Icons/RJW_Genes_Endogene_Background</backgroundPathEndogenes>
<backgroundPathXenogenes>Genes/Icons/RJW_Genes_Xenogene_Background</backgroundPathXenogenes>
</li>
<li Class="RJW_Genes.GenderFluidExtension">
<li Class="RJW_Genes.TickBasedChanceExtension">
<!-- 120k = 2 days -->
<changeInterval>120000</changeInterval>
<changeChance>0.25</changeChance>
<tickInterval>120000</tickInterval>
<eventChance>0.25</eventChance>
</li>
</modExtensions>
</GeneDef>

View file

@ -12,6 +12,7 @@ This mod adds genes related and based on RJW to Rimworld.
- Sexual Vampires that need Cum, Cocks or some other sources.
- Mech Breeding Additions & Orgasmic Mytosis
- Human-Animal Gene Inheritance merged from [Shabakur](https://github.com/Shabakur/RJW_Animal_Gene_Inheritance)
- Genetic Diseases that spread on Intercourse
- Patches for some popular / common Xenotypes from other Mods.
*You might not see all of them. Many genes just show up if other mods are loaded*.

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class TickBasedChanceExtension : TickIntervalExtension
{
/// <summary>
/// Set to 1 for "always", set to 0 for "never".
/// Everything else is a bit statistics, but e.g. when set to .5 the chances grow per day from [50%, 75%, 82.25%, ...]
/// </summary>
public float eventChance;
}
}

View file

@ -124,6 +124,8 @@ namespace RJW_Genes
// Diseases
public static readonly GeneDef rjw_genes_genetic_disease_immunity;
public static readonly GeneDef rjw_genes_minor_vulnerability;
public static readonly GeneDef rjw_genes_major_vulnerability;
public static readonly GeneDef rjw_genes_fluctual_sexual_needs;
//Other Defs
public static readonly XenotypeDef rjw_genes_succubus;

View file

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

View file

@ -0,0 +1,57 @@
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using static HarmonyLib.Code;
using static RimWorld.ColonistBar;
namespace RJW_Genes
{
public class Gene_FluctualSexualNeed : Gene
{
int event_interval;
float event_chance;
const float REST_INCREASE = 0.1f;
const float SET_SEXNEED_TO = 0.1f;
public Gene_FluctualSexualNeed() : base()
{
TickBasedChanceExtension tickbasedChanceExt = GeneDefOf.rjw_genes_fluctual_sexual_needs.GetModExtension<TickBasedChanceExtension>();
event_interval = tickbasedChanceExt?.tickInterval ?? 30000; // 30K = 1/2 day
event_chance = tickbasedChanceExt?.eventChance ?? 0.1f;
}
public override void Tick()
{
base.Tick();
if (pawn.IsHashIntervalTick(event_interval) && (new Random()).NextDouble() < event_chance)
{
ModLog.Debug($"Firing Gene_FluctualSexualNeed for {pawn}");
ApplyFluctualSexNeedEffect(pawn);
}
}
public static void ApplyFluctualSexNeedEffect(Pawn pawn)
{
if (pawn == null || pawn.needs == null) return;
var sexneed = pawn.needs.TryGetNeed<rjw.Need_Sex>();
if (sexneed != null)
{
sexneed.CurLevelPercentage = SET_SEXNEED_TO;
}
// Pump up Wake-Ness
if (pawn.needs.rest != null)
pawn.needs.rest.CurLevel += REST_INCREASE;
}
}
}

View file

@ -15,6 +15,8 @@ namespace RJW_Genes.Genes.Diseases.Patches
public static void Postfix(SexProps props)
{
if (!RJW_Genes_Settings.rjw_genes_genetic_disease_spread) return;
if (props == null || props.pawn == null || props.partner == null) return;
Pawn pawn = props.pawn;
@ -26,6 +28,9 @@ namespace RJW_Genes.Genes.Diseases.Patches
// No Infections on Condom Use
if (props.usedCondom) return;
// Exit early if settings require penetrative sex, but this is not penetrative sex
if (!IsPenetrativeSex(props) && RJW_Genes_Settings.rjw_genes_genetic_disease_spread_only_on_penetrative_sex) return;
ModLog.Debug($"Firing Patch_TransferGeneticDiseases for {pawn} and {partner}");
TryTransferGeneticDiseases(pawn, partner, props);
TryTransferGeneticDiseases(partner, pawn, props);
@ -47,7 +52,7 @@ namespace RJW_Genes.Genes.Diseases.Patches
if ((new Random()).NextDouble() <= LookupDiseaseInfectionChance(disease))
{
infected.genes.AddGene(disease, false);
infected.genes.AddGene(disease, !RJW_Genes_Settings.rjw_genes_genetic_disease_as_endogenes);
}
}
}
@ -67,9 +72,24 @@ namespace RJW_Genes.Genes.Diseases.Patches
return new List<GeneDef>() { };
}
private static bool IsPenetrativeSex(SexProps props)
{
if (props == null) return false;
return props.sexType ==
xxx.rjwSextype.Vaginal
|| props.sexType == xxx.rjwSextype.Anal
|| props.sexType == xxx.rjwSextype.Oral
|| props.sexType == xxx.rjwSextype.DoublePenetration
|| props.sexType == xxx.rjwSextype.Fellatio
|| props.sexType == xxx.rjwSextype.Sixtynine;
}
private static bool IsGeneticDiseaseGene(GeneDef geneDef)
{
return geneDef.geneClass.FullName.Contains("DiseaseGene");
if (geneDef == null) return false;
GeneticDiseaseExtension diseaseExt = geneDef.GetModExtension<GeneticDiseaseExtension>();
return diseaseExt != null;
}
private static float LookupDiseaseInfectionChance(GeneDef geneDef)

View file

@ -1,20 +0,0 @@
using Verse;
namespace RJW_Genes
{
public class GenderFluidExtension : DefModExtension
{
/// <summary>
/// Number of ticks until the change can be triggered.
/// Just being "triggered" does not mean changing, see the changeChance below.
/// </summary>
public int changeInterval;
/// <summary>
/// How high is the chance to change gender?
/// Set to 1 for "always", set to 0 for "never".
/// Everything else is a bit statistics, but e.g. when set to .5 the chances grow per day from [50%, 75%, 82.25%, ...]
/// </summary>
public float changeChance;
}
}

View file

@ -39,9 +39,9 @@ namespace RJW_Genes
private bool sexChangeWasBlocked = false;
public Gene_GenderFluid() : base() {
GenderFluidExtension genderFluidExt = GeneDefOf.rjw_genes_gender_fluid.GetModExtension<GenderFluidExtension>();
change_interval = genderFluidExt?.changeInterval ?? CHANGE_INTERVAL_FALLBACK;
switch_chance = genderFluidExt?.changeChance ?? SWITCH_CHANCE_FALLBACK;
TickBasedChanceExtension tickbasedChanceExt = GeneDefOf.rjw_genes_gender_fluid.GetModExtension<TickBasedChanceExtension>();
change_interval = tickbasedChanceExt?.tickInterval ?? CHANGE_INTERVAL_FALLBACK;
switch_chance = tickbasedChanceExt?.eventChance ?? SWITCH_CHANCE_FALLBACK;
}
public override void Tick()

View file

@ -58,6 +58,7 @@
<Compile Include="Animal_Inheritance\Defs\BestialityGeneInheritanceDef.cs" />
<Compile Include="Common\Defs\DistanceExtension.cs" />
<Compile Include="Common\Defs\ModExtensionHelper.cs" />
<Compile Include="Common\Defs\TickBasedChanceExtension.cs" />
<Compile Include="Common\Either.cs" />
<Compile Include="Common\Helpers\LaborState.cs" />
<Compile Include="Common\Helpers\MapUtility.cs" />
@ -75,7 +76,7 @@
<Compile Include="Genes\Cum\Patch_LikesCumflation.cs" />
<Compile Include="Genes\Damage\Gene_Elasticity.cs" />
<Compile Include="Genes\Diseases\Defs\GeneticDiseaseExtension.cs" />
<Compile Include="Genes\Diseases\Genes\DiseaseGene.cs" />
<Compile Include="Genes\Diseases\Genes\Gene_FluctualSexualNeed.cs" />
<Compile Include="Genes\Diseases\Patches\Patch_AftersexUtility_TransferGeneticDiseases.cs" />
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" />
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />
@ -89,8 +90,7 @@
<Compile Include="Genes\Breeding\Patches\PatchMechBirth.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_Femboy.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_UdderBreasts.cs" />
<Compile Include="Genes\Gender\Defs\GenderFluidExtension.cs" />
<Compile Include="Genes\Gender\Gene_GenderFluid.cs" />
<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" />
@ -110,8 +110,8 @@
<Compile Include="Genes\ExtraGenitalia\Gene_NoPenis.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_ExtraPenis.cs" />
<Compile Include="Genes\Gender\GenderUtility.cs" />
<Compile Include="Genes\Gender\Gene_FemaleOnly.cs" />
<Compile Include="Genes\Gender\Gene_MaleOnly.cs" />
<Compile Include="Genes\Gender\Genes\Gene_FemaleOnly.cs" />
<Compile Include="Genes\Gender\Genes\Gene_MaleOnly.cs" />
<Compile Include="Genes\GeneUtility.cs" />
<Compile Include="Genes\GenitaliaSize\Gene_BigBreasts.cs" />
<Compile Include="Genes\GenitaliaSize\Gene_GenitaliaResizingGene.cs" />
@ -240,9 +240,7 @@
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Genes\Gender\Patches\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>