Adde some explanations in the code

This commit is contained in:
Shabakur 2022-12-27 14:54:47 +01:00
parent 1f865320b0
commit e8f9f94130
8 changed files with 17 additions and 8 deletions

Binary file not shown.

View File

@ -18,9 +18,9 @@
<stages> <stages>
<li> <li>
<becomeVisible>false</becomeVisible> <becomeVisible>false</becomeVisible>
<statOffsets> <statFactors>
<SexFrequency>2</SexFrequency> <SexFrequency>2</SexFrequency>
</statOffsets> </statFactors>
</li> </li>
</stages> </stages>
</HediffDef> </HediffDef>

View File

@ -20,6 +20,9 @@ namespace RJW_Genes
} }
//Modified code from https://gitgud.io/lutepickle/rjw_menstruation/-/tree/main/1.4/source/RJW_Menstruation/RJW_Menstruation //Modified code from https://gitgud.io/lutepickle/rjw_menstruation/-/tree/main/1.4/source/RJW_Menstruation/RJW_Menstruation
//Summary//
//Adds our own partpreferences to rjw's list. Our partpreferences are under Interactions.GenesPartKindUsageRule
//
private static void AddtoIPartPreferenceRule() private static void AddtoIPartPreferenceRule()
{ {
List<IPartPreferenceRule> partPreferenceRules = Unprivater.GetProtectedValue<List<IPartPreferenceRule>>("_partKindUsageRules", typeof(PartPreferenceDetectorService)); List<IPartPreferenceRule> partPreferenceRules = Unprivater.GetProtectedValue<List<IPartPreferenceRule>>("_partKindUsageRules", typeof(PartPreferenceDetectorService));

View File

@ -34,7 +34,7 @@ namespace RJW_Genes
} }
//Get total fluidamount a persom has. //Get total fluidamount a person has.
public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f) public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f)
{ {
var partBPR = Genital_Helper.get_genitalsBPR(pawn); var partBPR = Genital_Helper.get_genitalsBPR(pawn);

View File

@ -39,7 +39,7 @@ namespace RJW_Genes
yield break; yield break;
} }
//Depending on how low the value is it will increase sexdrive and if it reaches zero it will create a random rape mental break. //Depending on how low the value is it will increase sexdrive and if it reaches zero it will create a mental break which will make the pawn rape others.
//Not using base.Tick() as it is used to start mental breaks, but we have another way to do it. //Not using base.Tick() as it is used to start mental breaks, but we have another way to do it.
public override void Tick() public override void Tick()
{ {

View File

@ -14,7 +14,6 @@ namespace RJW_Genes
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))] [HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
public static class Patch_LifeForce public static class Patch_LifeForce
{ {
public static void Postfix(SexProps props) public static void Postfix(SexProps props)
{ {
// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation) // ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation)
@ -27,7 +26,7 @@ namespace RJW_Genes
{ {
Pawn_GeneTracker genes = props.pawn.genes; Pawn_GeneTracker genes = props.pawn.genes;
Gene_LifeForce gene = genes.GetFirstGeneOfType<Gene_LifeForce>(); Gene_LifeForce gene = genes.GetFirstGeneOfType<Gene_LifeForce>();
gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.partner); //total amount may need to be modified to be balanced gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.partner); //total amount may need to be modified to be balanced or maybe I should just consider one at random
} }
} }
} }

View File

@ -12,6 +12,8 @@ namespace RJW_Genes
{ {
public class Gene_Aphrodisiac_Pheromones : Gene public class Gene_Aphrodisiac_Pheromones : Gene
{ {
//Summary one every one check for all pawns nearby and in line of sight and add/renew a hediff which increases sexdrive for six hours.
public override void Tick() public override void Tick()
{ {
base.Tick(); base.Tick();
@ -24,11 +26,12 @@ namespace RJW_Genes
} }
} }
//Creatus an IEnumerable of all pawns which are closeby and in lineofsight
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 (pos.DistanceTo(pawn.Position) < 5) if (pos.DistanceTo(pawn.Position) < 5 && GenSight.LineOfSight(pos, pawn.Position, pawn.Map))
{ {
yield return pawn; yield return pawn;
} }
@ -37,6 +40,7 @@ namespace RJW_Genes
yield break; yield break;
} }
//Applies er renews a hediff which increases sexdrive for 6 hours
private void InduceAphrodisiac(Pawn pawn) private void InduceAphrodisiac(Pawn pawn)
{ {
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Aphrodisiac_Pheromone); Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Aphrodisiac_Pheromone);

View File

@ -9,7 +9,10 @@ using Verse;
namespace RJW_Genes.Interactions namespace RJW_Genes.Interactions
{ {
public class GenesPartKindUsageRule : IPartPreferenceRule //Summary//
//Set custom preferences for pawn. Gets integrated to rjw by AddtoIPartPreferenceRule in First
//Depending on the level of lifeforce increase the chance for using the mouth.
public class GenesPartKindUsageRule : IPartPreferenceRule
{ {
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context)
{ {