mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	sexage check Fertilin and FertilinDraingene
Fertilin and all subgenes are only active if pawn is old enough to have sex, 13 if rjw teensex is enabled else 18. Added a fertilindraingene which greatly increases fertilin burn, but gives a lot of metabolic efficiency Also moved a few files into subfolders.
This commit is contained in:
		
							parent
							
								
									2e1e74e0b1
								
							
						
					
					
						commit
						09157e923d
					
				
					 21 changed files with 166 additions and 81 deletions
				
			
		| 
						 | 
				
			
			@ -18,28 +18,25 @@ namespace RJW_Genes
 | 
			
		|||
        //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)
 | 
			
		||||
        {
 | 
			
		||||
            Pawn_GeneTracker genes2 = pawn.genes;
 | 
			
		||||
            Gene_LifeForce gene_LifeForce = (genes2 != null) ? genes2.GetFirstGeneOfType<Gene_LifeForce>() : null;
 | 
			
		||||
            Pawn_GeneTracker genes = pawn.genes;
 | 
			
		||||
            Gene_LifeForce gene_LifeForce = genes.GetFirstGeneOfType<Gene_LifeForce>();
 | 
			
		||||
            return gene_LifeForce;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void OffsetLifeForce(Gene_LifeForce gene_LifeForce, float offset, bool applyStatFactor = true)
 | 
			
		||||
        {
 | 
			
		||||
            if (gene_LifeForce != null)
 | 
			
		||||
            {
 | 
			
		||||
                float old_value = gene_LifeForce.Value;
 | 
			
		||||
                gene_LifeForce.Value += offset;
 | 
			
		||||
                PostOffSetLifeForce(gene_LifeForce, old_value);
 | 
			
		||||
            }
 | 
			
		||||
        public static void OffsetLifeForce(IGeneResourceDrain drain, float offset)
 | 
			
		||||
        {                
 | 
			
		||||
            float old_value = drain.Resource.Value;
 | 
			
		||||
            drain.Resource.Value += offset;
 | 
			
		||||
            //PostOffSetLifeForce(drain, old_value);     
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void PostOffSetLifeForce(Gene_LifeForce gene_LifeForce, float old_value)
 | 
			
		||||
        public static void PostOffSetLifeForce(IGeneResourceDrain drain, float old_value)
 | 
			
		||||
        {
 | 
			
		||||
            if (old_value > 0.15f && gene_LifeForce.Resource.Value <= 0.15f)
 | 
			
		||||
            if (old_value > 0.2f && drain.Resource.Value <= 0.2f)
 | 
			
		||||
            {
 | 
			
		||||
                Pawn pawn = gene_LifeForce.Pawn;
 | 
			
		||||
                Pawn pawn = drain.Pawn;
 | 
			
		||||
                
 | 
			
		||||
                //Give thoughtdef
 | 
			
		||||
                //Do things
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ namespace RJW_Genes
 | 
			
		|||
					if (GenitaliaChanger.IsArtificial(part))
 | 
			
		||||
						continue;
 | 
			
		||||
 | 
			
		||||
					if (rjw.Genital_Helper.is_penis(part))
 | 
			
		||||
					if (Genital_Helper.is_penis(part))
 | 
			
		||||
					{
 | 
			
		||||
						GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), part.Severity); ;
 | 
			
		||||
						pawn.health.RemoveHediff(part);
 | 
			
		||||
| 
						 | 
				
			
			@ -83,5 +83,17 @@ namespace RJW_Genes
 | 
			
		|||
			}
 | 
			
		||||
			return base.Valid(target, throwMessages);
 | 
			
		||||
		}
 | 
			
		||||
		public override bool GizmoDisabled(out string reason)
 | 
			
		||||
		{
 | 
			
		||||
			Pawn_GeneTracker genes = this.parent.pawn.genes;
 | 
			
		||||
			Gene_LifeForce gene_LifeForce = (genes != null) ? genes.GetFirstGeneOfType<Gene_LifeForce>() : null;
 | 
			
		||||
			if (gene_LifeForce == null)
 | 
			
		||||
			{
 | 
			
		||||
				reason = "AbilityDisabledNoFertilinGene".Translate(this.parent.pawn);
 | 
			
		||||
				return true;
 | 
			
		||||
			}
 | 
			
		||||
			reason = null;
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -8,11 +8,9 @@ using Verse.AI;
 | 
			
		|||
using RimWorld;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	// Token: 0x02000F66 RID: 3942
 | 
			
		||||
	public class CompAbilityEffect_LifeForceCost : CompAbilityEffect
 | 
			
		||||
	{
 | 
			
		||||
		// Token: 0x17000FFB RID: 4091
 | 
			
		||||
		// (get) Token: 0x06005D18 RID: 23832 RVA: 0x001FA767 File Offset: 0x001F8967
 | 
			
		||||
 | 
			
		||||
		public new CompProperties_AbilityLifeForceCost Props
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
| 
						 | 
				
			
			@ -21,8 +19,6 @@ namespace RJW_Genes
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Token: 0x17000FFC RID: 4092
 | 
			
		||||
		// (get) Token: 0x06005D19 RID: 23833 RVA: 0x001FA774 File Offset: 0x001F8974
 | 
			
		||||
		private bool HasEnoughFertilin
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
| 
						 | 
				
			
			@ -33,14 +29,13 @@ namespace RJW_Genes
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Token: 0x06005D1A RID: 23834 RVA: 0x001FA7B7 File Offset: 0x001F89B7
 | 
			
		||||
		public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
 | 
			
		||||
		{
 | 
			
		||||
			base.Apply(target, dest);
 | 
			
		||||
			GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), -this.Props.fertilinCost, true);
 | 
			
		||||
			GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), -this.Props.fertilinCost);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Token: 0x06005D1B RID: 23835 RVA: 0x001FA7E0 File Offset: 0x001F89E0
 | 
			
		||||
 | 
			
		||||
		public override bool GizmoDisabled(out string reason)
 | 
			
		||||
		{
 | 
			
		||||
			Pawn_GeneTracker genes = this.parent.pawn.genes;
 | 
			
		||||
| 
						 | 
				
			
			@ -111,8 +106,7 @@ namespace RJW_Genes
 | 
			
		|||
			}
 | 
			
		||||
			return num2;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		//Modified version of HemogenCost in Ability
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6,18 +6,35 @@ using System.Threading.Tasks;
 | 
			
		|||
using UnityEngine;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
 | 
			
		||||
using rjw;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_LifeForce : Gene_Resource, IGeneResourceDrain
 | 
			
		||||
	{
 | 
			
		||||
		public override void ExposeData()
 | 
			
		||||
        //Gene should only be active if sex is allowed for this pawn 
 | 
			
		||||
        public override bool Active
 | 
			
		||||
		{
 | 
			
		||||
			base.ExposeData();
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if (this.Overridden)
 | 
			
		||||
				{
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
				Pawn pawn = this.pawn;
 | 
			
		||||
				
 | 
			
		||||
				return ((pawn != null) ? pawn.ageTracker : null) == null || 
 | 
			
		||||
					((float)this.pawn.ageTracker.AgeBiologicalYears >= this.def.minAgeActive && this.pawn.ageTracker.AgeBiologicalYears >= (RJWSettings.AllowYouthSex ? 13f : 18f));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public bool ShouldConsumeLifeForceNow()
 | 
			
		||||
        public override void ExposeData()
 | 
			
		||||
        {
 | 
			
		||||
            base.ExposeData();
 | 
			
		||||
			Scribe_Values.Look<bool>(ref this.StoredCumAllowed, "StoredCumAllowed", true, false);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        public bool ShouldConsumeLifeForceNow()
 | 
			
		||||
		{
 | 
			
		||||
			return this.Value < this.targetValue;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -43,14 +60,7 @@ namespace RJW_Genes
 | 
			
		|||
			//base.Tick();
 | 
			
		||||
			if (this.CanOffset && this.Resource != null)
 | 
			
		||||
            {
 | 
			
		||||
				if (this.CanOffset)
 | 
			
		||||
				{
 | 
			
		||||
					if (this.Resource == null)
 | 
			
		||||
					{
 | 
			
		||||
						return;
 | 
			
		||||
					}
 | 
			
		||||
					GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000f);
 | 
			
		||||
				}
 | 
			
		||||
				GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000f);
 | 
			
		||||
				//this.Resource.Value -= this.ResourceLossPerDay / 60000;
 | 
			
		||||
				if (this.Resource.Value <= 0 && this.pawn.IsHashIntervalTick(300))
 | 
			
		||||
				{
 | 
			
		||||
| 
						 | 
				
			
			@ -62,11 +72,9 @@ namespace RJW_Genes
 | 
			
		|||
					}
 | 
			
		||||
				}
 | 
			
		||||
            }
 | 
			
		||||
			//GeneResourceDrainUtility.TickResourceDrain(this);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public bool StoredCumAllowed = true;
 | 
			
		||||
 | 
			
		||||
		public Gene_Resource Resource
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
| 
						 | 
				
			
			@ -117,7 +125,7 @@ namespace RJW_Genes
 | 
			
		|||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return 0.15f;
 | 
			
		||||
				return 0.2f;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public override float MaxLevelOffset
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										79
									
								
								Source/Genes/Life_Force/Gene_LifeForceDrain.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								Source/Genes/Life_Force/Gene_LifeForceDrain.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,79 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	public class Gene_LifeForceDrain : Gene, IGeneResourceDrain
 | 
			
		||||
	{
 | 
			
		||||
		public Gene_Resource Resource
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if (this.cachedLifeForceGene == null || !this.cachedLifeForceGene.Active)
 | 
			
		||||
				{
 | 
			
		||||
					this.cachedLifeForceGene = this.pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
 | 
			
		||||
				}
 | 
			
		||||
				return this.cachedLifeForceGene;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public bool CanOffset
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this.Active && this.Resource != null && this.Resource.Active;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public float ResourceLossPerDay
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this.def.resourceLossPerDay;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public Pawn Pawn
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this.pawn;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public string DisplayLabel
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this.Label + " (" + "Gene".Translate() + ")";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override void Tick()
 | 
			
		||||
		{
 | 
			
		||||
			base.Tick();
 | 
			
		||||
			if (this.CanOffset && this.Resource != null)
 | 
			
		||||
            {
 | 
			
		||||
				GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000);
 | 
			
		||||
			}			
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override IEnumerable<Gizmo> GetGizmos()
 | 
			
		||||
		{
 | 
			
		||||
			foreach (Gizmo gizmo in GeneResourceDrainUtility.GetResourceDrainGizmos(this))
 | 
			
		||||
			{
 | 
			
		||||
				yield return gizmo;
 | 
			
		||||
			}
 | 
			
		||||
			IEnumerator<Gizmo> enumerator = null;
 | 
			
		||||
			yield break;
 | 
			
		||||
			yield break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[Unsaved(false)]
 | 
			
		||||
		private Gene_LifeForce cachedLifeForceGene;
 | 
			
		||||
 | 
			
		||||
		private const float MinAgeForDrain = 3f;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,16 +0,0 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Interaction_weights
 | 
			
		||||
    {
 | 
			
		||||
        public InteractionDef interaction;
 | 
			
		||||
        public int weight = 1;
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -4,7 +4,6 @@ using Verse.AI;
 | 
			
		|||
using rjw;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	// Token: 0x020000FB RID: 251
 | 
			
		||||
	public class LifeForceMentalStateWorker : MentalStateWorker
 | 
			
		||||
	{
 | 
			
		||||
		public override bool StateCanOccur(Pawn pawn)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,17 +114,18 @@
 | 
			
		|||
    <Compile Include="Genes\Genitalia\Gene_DemonicGenitalia.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\Gene_EquineGenitalia.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\GenitaliaChanger.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\AbilityUtility.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\AbilityUtility.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Alert_LowFertilin.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\CompAbilityEffect_Seduce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\CompAbilityEffect_LifeForceCost.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\CompAbilityEffect_CockEater.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\CompProperties_Seduce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\CompProperties_AbilityCockEater.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_Seduce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_LifeForceCost.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_CockEater.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompProperties_Seduce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityCockEater.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Gene_LifeForceDrain.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\IngestionOutcomeDoer_LifeForceOffset.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobDriver_SexOnSpotReceiver.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobDriver_SexOnSpot.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobDriver_Seduced.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobDrivers\JobDriver_SexOnSpotReceiver.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobDrivers\JobDriver_SexOnSpot.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobDrivers\JobDriver_Seduced.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Patch_SexTicks_ChangePsyfocus.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\ThinkNode_ConditionalLowLifeForce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\ThinkNode_ConditionalCritcalLifeForce.cs" />
 | 
			
		||||
| 
						 | 
				
			
			@ -133,14 +134,13 @@
 | 
			
		|||
    <Compile Include="Genes\Special\Patch_AgeDrain.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Patch_Youth_Fountain.cs" />
 | 
			
		||||
    <Compile Include="Interactions\CompAbility_SexInteractionRequirements.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\CompAbilityEffect_PussyHeal.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\CompProperties_AbilityLifeForceCost.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_PussyHeal.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityLifeForceCost.cs" />
 | 
			
		||||
    <Compile Include="Interactions\CompProperties_SexInteractionRequirements.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\CompProperties_AbilityPussyHeal.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityPussyHeal.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\GeneGizmo_ResourceLifeForce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\HediffWithComps_tank.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Interactionchances.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobDriver_CastAbilityAfterSex.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobDrivers\JobDriver_CastAbilityAfterSex.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\LifeForceMentalState.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\LifeForceMentalStateWorker.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobGiver_LifeForce_RandomRape.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue