mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Added Gene Aphrodisiac Pheromones and some settings
This commit is contained in:
		
							parent
							
								
									7bf8efb00d
								
							
						
					
					
						commit
						f0a9cce9c9
					
				
					 12 changed files with 134 additions and 6 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -9,5 +9,16 @@
 | 
			
		|||
        <iconPath>UI/Memes/FleshPurity</iconPath>
 | 
			
		||||
        <displayOrderInCategory>1</displayOrderInCategory>
 | 
			
		||||
    </GeneDef>
 | 
			
		||||
    
 | 
			
		||||
	
 | 
			
		||||
    <GeneDef>
 | 
			
		||||
        <defName>rjw_genes_aphrodisiac_pheromones</defName>
 | 
			
		||||
        <label>Aphrodisiac Pheromones</label>
 | 
			
		||||
        <displayCategory>rjw_genes_special</displayCategory>
 | 
			
		||||
		<geneClass>RJW_Genes.Gene_Aphrodisiac_Pheromones</geneClass>
 | 
			
		||||
        <description>Pheremones of this pawn induce an incressed sexdrive to others nearby.</description>
 | 
			
		||||
        <iconPath>UI/Memes/FleshPurity</iconPath>
 | 
			
		||||
        <displayOrderInCategory>2</displayOrderInCategory>
 | 
			
		||||
		<biostatCpx>1</biostatCpx>
 | 
			
		||||
		<biostatMet>1</biostatMet>
 | 
			
		||||
    </GeneDef>
 | 
			
		||||
</Defs>
 | 
			
		||||
							
								
								
									
										27
									
								
								Common/Defs/HediffDefs/Hediffs_Genes.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Common/Defs/HediffDefs/Hediffs_Genes.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
<?xml version="1.0" encoding="utf-8" ?>
 | 
			
		||||
 | 
			
		||||
<!--all pregnancies-->
 | 
			
		||||
<Defs>
 | 
			
		||||
	<HediffDef>
 | 
			
		||||
		<defName>Aphrodisiac_Pheromone</defName>
 | 
			
		||||
		<hediffClass>HediffWithComps</hediffClass>
 | 
			
		||||
		<label>induced libido</label>
 | 
			
		||||
		<description>Aphrodisiac pheromone effects.</description>
 | 
			
		||||
		<defaultLabelColor>(1,0,0.5)</defaultLabelColor>
 | 
			
		||||
		<scenarioCanAdd>true</scenarioCanAdd>
 | 
			
		||||
		<maxSeverity>1.0</maxSeverity>
 | 
			
		||||
		<comps>
 | 
			
		||||
			<li Class="HediffCompProperties_SeverityPerDay">
 | 
			
		||||
				<severityPerDay>-4.0</severityPerDay>
 | 
			
		||||
			</li>
 | 
			
		||||
		</comps>
 | 
			
		||||
		<stages>
 | 
			
		||||
			<li>
 | 
			
		||||
				<becomeVisible>false</becomeVisible>
 | 
			
		||||
				<statOffsets>
 | 
			
		||||
					<SexFrequency>2</SexFrequency>
 | 
			
		||||
				</statOffsets>
 | 
			
		||||
			</li>
 | 
			
		||||
		</stages>
 | 
			
		||||
	</HediffDef>
 | 
			
		||||
</Defs>
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ namespace RJW_BGS
 | 
			
		|||
            {
 | 
			
		||||
                foreach (BestialityGeneInheritanceDef gene in raceGeneDef.genes)
 | 
			
		||||
                {
 | 
			
		||||
                    if (gene.chance >= Rand.Range(0.01f,1f))
 | 
			
		||||
                    if (gene.chance * RJW_BGSSettings.global_gene_chance  >= Rand.Range(0.01f,1f))
 | 
			
		||||
                    {
 | 
			
		||||
                        genelist.Add(DefDatabase<GeneDef>.GetNamed(gene.defName));
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			@ -64,8 +64,13 @@ namespace RJW_BGS
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //For ParchRJWHediffInsect_egg
 | 
			
		||||
        public static void NewGenes(Pawn mother, Pawn dad, Pawn baby)
 | 
			
		||||
        {
 | 
			
		||||
            if (!RJW_BGSSettings.enabled)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (baby.RaceProps.Humanlike)
 | 
			
		||||
            {
 | 
			
		||||
                if (baby.genes == null)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,10 @@ namespace RJW_BGS
 | 
			
		|||
        [HarmonyPostfix]
 | 
			
		||||
        public static void AddGenes(Pawn mother, Pawn dad, ref Hediff_BasePregnancy __instance)
 | 
			
		||||
        {
 | 
			
		||||
            if (!RJW_BGSSettings.enabled)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            foreach (Pawn baby in __instance.babies)
 | 
			
		||||
            {
 | 
			
		||||
                if (baby.RaceProps.Humanlike)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,6 +22,10 @@ namespace RJW_BGS
 | 
			
		|||
        [HarmonyPostfix]
 | 
			
		||||
        public static void AnimalInheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
 | 
			
		||||
        {
 | 
			
		||||
            if (!RJW_BGSSettings.enabled)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            List<GeneDef> genes = InheritanceUtility.AnimalInheritedGenes(father, mother);
 | 
			
		||||
            if (genes.Any())
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
			
		|||
using Verse;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes.Animal_Inheritance
 | 
			
		||||
namespace RJW_BGS
 | 
			
		||||
{
 | 
			
		||||
    public class RJW_BGSSettings : ModSettings
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -23,6 +23,10 @@ namespace RJW_Genes.Animal_Inheritance
 | 
			
		|||
            listing_Standard.Gap(24f);
 | 
			
		||||
            listing_Standard.CheckboxLabeled("enabled", ref enabled, "no function yet", 0f, 1f);
 | 
			
		||||
            //listing_Standard.CheckboxLabeled("sexfrenzy", ref sexfrenzy, "disable the effects", 0f, 1f);
 | 
			
		||||
            listing_Standard.Gap(5f);
 | 
			
		||||
            listing_Standard.Label("gene inheritance chance"+ ": " + 
 | 
			
		||||
                Math.Round((double)(RJW_BGSSettings.global_gene_chance * 100f), 0).ToString() + "%", -1f, "modify chance for a gene to be inherited.");
 | 
			
		||||
            RJW_BGSSettings.global_gene_chance = listing_Standard.Slider(RJW_BGSSettings.global_gene_chance, 0f, 5f);
 | 
			
		||||
            listing_Standard.End();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -30,8 +34,10 @@ namespace RJW_Genes.Animal_Inheritance
 | 
			
		|||
        {
 | 
			
		||||
            base.ExposeData();
 | 
			
		||||
            Scribe_Values.Look<bool>(ref RJW_BGSSettings.enabled, "enabled", RJW_BGSSettings.enabled, true);
 | 
			
		||||
            Scribe_Values.Look<float>(ref RJW_BGSSettings.global_gene_chance, "global_gene_chance", RJW_BGSSettings.global_gene_chance, true);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool enabled;
 | 
			
		||||
        public static float global_gene_chance = 1f;
 | 
			
		||||
        public static bool enabled = true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
			
		|||
using Verse;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes.Animal_Inheritance
 | 
			
		||||
namespace RJW_BGS
 | 
			
		||||
{
 | 
			
		||||
    public class RJW_BGSSettingsController : Mod
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,6 +70,6 @@ namespace RJW_Genes
 | 
			
		|||
 | 
			
		||||
		// Special
 | 
			
		||||
		public static readonly GeneDef rjw_genes_orgasm_rush;
 | 
			
		||||
 | 
			
		||||
		public static readonly GeneDef rjw_genes_aphrodisiac_pheromones;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										53
									
								
								Source/Genes/Special/Gene_Aphrodisiac_Pheromones_.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								Source/Genes/Special/Gene_Aphrodisiac_Pheromones_.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using rjw;
 | 
			
		||||
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 Gene_Aphrodisiac_Pheromones : Gene
 | 
			
		||||
    {   
 | 
			
		||||
        public override void Tick()
 | 
			
		||||
        {
 | 
			
		||||
            base.Tick();
 | 
			
		||||
            if (this.pawn.IsHashIntervalTick(2500))
 | 
			
		||||
            {
 | 
			
		||||
                foreach (Pawn pawn in this.AffectedPawns(this.pawn.Position, this.pawn.Map))
 | 
			
		||||
                { 
 | 
			
		||||
                    this.InduceAphrodisiac(pawn);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private IEnumerable<Pawn> AffectedPawns(IntVec3 pos, Map map)
 | 
			
		||||
        {
 | 
			
		||||
            foreach (Pawn pawn in map.mapPawns.AllPawns)
 | 
			
		||||
            {
 | 
			
		||||
                if (pos.DistanceTo(pawn.Position) < 5)
 | 
			
		||||
                {
 | 
			
		||||
                    yield return pawn;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            //IEnumerator<Pawn> enumerator = null;
 | 
			
		||||
            yield break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void InduceAphrodisiac(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Aphrodisiac_Pheromone);
 | 
			
		||||
            if (hediff != null)
 | 
			
		||||
            {
 | 
			
		||||
                hediff.Severity = 1f;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                pawn.health.AddHediff(HediffDefOf.Aphrodisiac_Pheromone);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								Source/HediffDefOf.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Source/HediffDefOf.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    [DefOf]
 | 
			
		||||
    public static class HediffDefOf
 | 
			
		||||
    {
 | 
			
		||||
        public static readonly HediffDef Aphrodisiac_Pheromone;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -116,8 +116,10 @@
 | 
			
		|||
    <Compile Include="Genes\Genitalia\GenitaliaChanger.cs" />
 | 
			
		||||
    <Compile Include="Genes\RJW_Gene.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\GenitaliaUtility.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones_.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Patch_OrgasmRush.cs" />
 | 
			
		||||
    <Compile Include="HarmonyInit.cs" />
 | 
			
		||||
    <Compile Include="HediffDefOf.cs" />
 | 
			
		||||
    <Compile Include="Properties\AssemblyInfo.cs" />
 | 
			
		||||
    <Compile Include="RJW_Genes.cs" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue