mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Merge branch 'WildWalker' into dev
This commit is contained in:
		
						commit
						23e143c381
					
				
					 16 changed files with 374 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -69,7 +69,12 @@ namespace RJW_Genes
 | 
			
		|||
		public static readonly GeneDef rjw_genes_mechbreeder;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_zoophile;
 | 
			
		||||
        public static readonly GeneDef rjw_genes_fertile_anus;
 | 
			
		||||
        // Cum 
 | 
			
		||||
		public static readonly GeneDef rjw_genes_mating_call;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_fervent_ovipositor;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_insectbreeder;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_insectincubator;
 | 
			
		||||
        
 | 
			
		||||
		// Cum 
 | 
			
		||||
        public static readonly GeneDef rjw_genes_no_cum;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_much_cum;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_very_much_cum;
 | 
			
		||||
| 
						 | 
				
			
			@ -97,6 +102,8 @@ namespace RJW_Genes
 | 
			
		|||
		public static readonly GeneDef rjw_genes_aphrodisiac_pheromones;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_sexual_mytosis;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_hormonal_saliva;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_cocoonweaver;
 | 
			
		||||
        public static readonly GeneDef rjw_genes_sex_tamer;
 | 
			
		||||
 | 
			
		||||
        // Cosmetic
 | 
			
		||||
        public static readonly GeneDef rjw_genes_succubus_tail;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse.Sound;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld.Planet;
 | 
			
		||||
using rjw;
 | 
			
		||||
using HarmonyLib;
 | 
			
		||||
using Verse.AI;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class CompAbilityEffect_MatingCall : CompAbilityEffect
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        bool fired = false; 
 | 
			
		||||
        private new CompProperties_AbilityMatingCall Props
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return (CompProperties_AbilityMatingCall)this.props;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
 | 
			
		||||
        {
 | 
			
		||||
            base.Apply(target, dest);
 | 
			
		||||
            ModLog.Message($"{this.parent.pawn} is casting MatingCall");
 | 
			
		||||
            AnimalBreedingHelper.DoAnimalBreedingPulse(this.parent.pawn, Props.calldistance);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using Verse.AI;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class CompAbilityEffect_PheromoneSpit : CompAbilityEffect
 | 
			
		||||
    {
 | 
			
		||||
        bool fired = false;
 | 
			
		||||
        private new CompProperties_AbilityPheromoneSpit Props
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return (CompProperties_AbilityPheromoneSpit)this.props;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
 | 
			
		||||
        {
 | 
			
		||||
            base.Apply(target, dest);
 | 
			
		||||
            AnimalBreedingHelper.DoAnimalBreedingPulse(target.Pawn, Props.calldistance);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class CompProperties_AbilityMatingCall : CompProperties_AbilityEffect
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public int calldistance;
 | 
			
		||||
 | 
			
		||||
        public CompProperties_AbilityMatingCall()
 | 
			
		||||
        {
 | 
			
		||||
            this.compClass = typeof(CompAbilityEffect_MatingCall);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes { 
 | 
			
		||||
    public class CompProperties_AbilityPheromoneSpit : CompProperties_AbilityEffect
 | 
			
		||||
    {
 | 
			
		||||
        public int calldistance;
 | 
			
		||||
 | 
			
		||||
        public CompProperties_AbilityPheromoneSpit()
 | 
			
		||||
        {
 | 
			
		||||
            this.compClass = typeof(CompAbilityEffect_PheromoneSpit);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										70
									
								
								Source/Genes/Breeding/AnimalBreedingHelper.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								Source/Genes/Breeding/AnimalBreedingHelper.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,70 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse.AI;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class AnimalBreedingHelper
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Finds animals in a distance around a pawn, and schedules a breeding job. 
 | 
			
		||||
        /// This is done regardless of the animals genitalia at the moment.
 | 
			
		||||
        /// This function has no checks if the Pawn is hostile, downed, etc., such checks must be done upstream!
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="toBeBred">The pawn that will be target of breeding animals</param>
 | 
			
		||||
        /// <param name="pulse_distance">The range around the pawn for which animals will be triggered.</param>
 | 
			
		||||
        public static void DoAnimalBreedingPulse(Pawn toBeBred, int pulse_distance, bool ends_manhunter = true)
 | 
			
		||||
        {
 | 
			
		||||
            IEnumerable<Pawn> animals = GetAnimalsInRange(toBeBred.Map, toBeBred.Position, pulse_distance);
 | 
			
		||||
            int breeder_counter = 0;
 | 
			
		||||
 | 
			
		||||
            foreach (Pawn animal in animals)
 | 
			
		||||
            {
 | 
			
		||||
                if (ends_manhunter)
 | 
			
		||||
                    EndManHunter(animal);
 | 
			
		||||
                ForceBreedingJob(toBeBred, animal);
 | 
			
		||||
                breeder_counter++;
 | 
			
		||||
            }
 | 
			
		||||
            ModLog.Message($"{breeder_counter} of {animals.Count()} Animals in range are trying to breed {toBeBred}");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static IEnumerable<Pawn> GetAnimalsInRange(Map map, IntVec3 position, int distance)
 | 
			
		||||
        {
 | 
			
		||||
            IEnumerable<Pawn> animals = 
 | 
			
		||||
                map.mapPawns
 | 
			
		||||
                    .AllPawnsSpawned
 | 
			
		||||
                    .Where<Pawn>((Func<Pawn, bool>)(p => 
 | 
			
		||||
                        p.IsNonMutantAnimal 
 | 
			
		||||
                        && p.Position.InHorDistOf(position, distance)
 | 
			
		||||
                        && xxx.is_healthy_enough(p))
 | 
			
		||||
                    );
 | 
			
		||||
 | 
			
		||||
            return animals;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static void ForceBreedingJob(Pawn toBeBred, Pawn animal)
 | 
			
		||||
        {
 | 
			
		||||
            // Stopping all Jobs in this way is a bit heavy - but as it's only about Animals this should be fine. 
 | 
			
		||||
            animal.jobs.CaptureAndClearJobQueue();
 | 
			
		||||
            animal.jobs.StopAll();
 | 
			
		||||
            Job job = JobMaker.MakeJob(xxx.animalBreed, toBeBred);
 | 
			
		||||
            animal.jobs.TryTakeOrderedJob(job);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static void EndManHunter(Pawn animal)
 | 
			
		||||
        {
 | 
			
		||||
            if (animal.MentalState != null && (animal.MentalState.def == MentalStateDefOf.Manhunter || animal.MentalState.def == MentalStateDefOf.ManhunterPermanent))
 | 
			
		||||
            {
 | 
			
		||||
                animal?.MentalState?.RecoverFromState();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										57
									
								
								Source/Genes/Special/Patches/Patch_SexualTamer.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								Source/Genes/Special/Patches/Patch_SexualTamer.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using static RJWSexperience.RsDefOf;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    [HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
 | 
			
		||||
    public static class Patch_SexualTamer
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        public static void Postfix(SexProps props)
 | 
			
		||||
        {
 | 
			
		||||
            // ShortCuts: Exit Early if Pawn or Partner are null (can happen with Masturbation or other nieche-cases)
 | 
			
		||||
            if (props == null || props.pawn == null || !props.hasPartner() || props.partner == null)
 | 
			
		||||
                return;
 | 
			
		||||
            // Exit for non Animals or Animal on Animal
 | 
			
		||||
            if (!(props.pawn.IsAnimal() || props.partner.IsAnimal() ) )
 | 
			
		||||
                return;
 | 
			
		||||
            Pawn animal =  props.pawn.IsAnimal() ? props.pawn : props.partner;
 | 
			
		||||
            Pawn human = props.pawn.IsAnimal() ? props.partner : props.pawn;
 | 
			
		||||
 | 
			
		||||
            // Another Short Sanity Check
 | 
			
		||||
            if (animal == null || human == null ) return;
 | 
			
		||||
            if (human.genes == null) return;
 | 
			
		||||
 | 
			
		||||
            if (human.genes.HasActiveGene(GeneDefOf.rjw_genes_sex_tamer))
 | 
			
		||||
            {
 | 
			
		||||
                // Case 1: Wild Animal - Try to Tame
 | 
			
		||||
                if (animal.AnimalOrWildMan() && animal.Faction == null)
 | 
			
		||||
                {
 | 
			
		||||
                    if(RJW_Genes_Settings.rjw_genes_detailed_debug)
 | 
			
		||||
                        ModLog.Message($"{human} is a sextamer with bestiality on wild animal {animal} - trying to recruit");
 | 
			
		||||
                    human.interactions.TryInteractWith(animal, InteractionDefOf.TameAttempt);
 | 
			
		||||
                }
 | 
			
		||||
                // Case 2: Colony Animal - Try to Train 
 | 
			
		||||
                else if (human.Faction != null && animal.Faction == human.Faction && animal.training != null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (RJW_Genes_Settings.rjw_genes_detailed_debug)
 | 
			
		||||
                        ModLog.Message($"{human} is a sextamer with bestiality on colony animal {animal} - trying to train");
 | 
			
		||||
                    var trainable = animal.training.NextTrainableToTrain();
 | 
			
		||||
                    animal.training.Train(trainable, human);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -66,8 +66,13 @@
 | 
			
		|||
    <Compile Include="Common\ModLog.cs" />
 | 
			
		||||
    <Compile Include="Common\Defs\TickIntervalExtension.cs" />
 | 
			
		||||
    <Compile Include="Common\Patches\PatchImplants.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Gene_FerventOvipositor.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Gene_InsectIncubator.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Abilities\CompAbilityEffect_MatingCall.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Abilities\CompAbilityEffect_PheromoneSpit.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityMatingCall.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityPheromoneSpit.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\AnimalBreedingHelper.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Genes\Gene_FerventOvipositor.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Genes\Gene_InsectIncubator.cs" />
 | 
			
		||||
    <Compile Include="Genes\Damage\Gene_Elasticity.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />
 | 
			
		||||
| 
						 | 
				
			
			@ -78,8 +83,8 @@
 | 
			
		|||
    <Compile Include="Common\Patches\PatchGetParents.cs" />
 | 
			
		||||
    <Compile Include="Common\Patches\PatchPregnancyHelper.cs" />
 | 
			
		||||
    <Compile Include="GeneDefOf.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Gene_MechBreeder.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\PatchMechBirth.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Genes\Gene_MechBreeder.cs" />
 | 
			
		||||
    <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" />
 | 
			
		||||
| 
						 | 
				
			
			@ -172,6 +177,7 @@
 | 
			
		|||
    <Compile Include="Genes\Special\Patches\Patch_AgeDrain.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Patches\Patch_HormonalSaliva.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Patches\Patch_OrgasmMytosis.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Patches\Patch_SexualTamer.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Thoughts\ThoughtWorker_Aphrodisiac_Pheromones_Social.cs" />
 | 
			
		||||
    <Compile Include="LetterDefOf.cs" />
 | 
			
		||||
    <Compile Include="Interactions\SuccubusTailjob\CompAbility_SexInteractionRequirements.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue