mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Draft for Mating Call
This commit is contained in:
		
							parent
							
								
									983bbfd727
								
							
						
					
					
						commit
						79895f352e
					
				
					 9 changed files with 157 additions and 4 deletions
				
			
		
							
								
								
									
										50
									
								
								Common/Defs/AbilityDefs/Ability_MatingCall.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Common/Defs/AbilityDefs/Ability_MatingCall.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,50 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <AbilityDef>
 | 
				
			||||||
 | 
					    <defName>rjw_genes_ability_mating_call</defName>
 | 
				
			||||||
 | 
					    <label>Mating Call</label>
 | 
				
			||||||
 | 
					    <description>Calls nearby animals to breed me.</description>
 | 
				
			||||||
 | 
					    <iconPath>UI/Abilities/AnimalBerserkPulse</iconPath>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <displayGizmoWhileUndrafted>true</displayGizmoWhileUndrafted>
 | 
				
			||||||
 | 
					    <disableGizmoWhileUndrafted>false</disableGizmoWhileUndrafted>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <casterMustBeCapableOfViolence>false</casterMustBeCapableOfViolence>
 | 
				
			||||||
 | 
					    <statBases>
 | 
				
			||||||
 | 
					        <Ability_Duration>50</Ability_Duration>
 | 
				
			||||||
 | 
					        <Ability_EffectRadius>0</Ability_EffectRadius>
 | 
				
			||||||
 | 
					    </statBases>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <displayOrder>410</displayOrder>
 | 
				
			||||||
 | 
					    <!-- 30k Ticks = 12h -->
 | 
				
			||||||
 | 
					    <cooldownTicksRange>30000</cooldownTicksRange>
 | 
				
			||||||
 | 
					    <verbProperties>
 | 
				
			||||||
 | 
					        <warmupTime>5</warmupTime>
 | 
				
			||||||
 | 
					        <verbClass>Verb_CastAbility</verbClass>
 | 
				
			||||||
 | 
					        <targetParams>
 | 
				
			||||||
 | 
					          <canTargetHumans>False</canTargetHumans>
 | 
				
			||||||
 | 
					          <canTargetMechs>False</canTargetMechs>
 | 
				
			||||||
 | 
					          <canTargetAnimals>True</canTargetAnimals>
 | 
				
			||||||
 | 
					          <canTargetLocations>True</canTargetLocations>
 | 
				
			||||||
 | 
					        </targetParams>
 | 
				
			||||||
 | 
					      </verbProperties>
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					      <comps>
 | 
				
			||||||
 | 
					        <li Class="CompProperties_AbilityFleckOnTarget">
 | 
				
			||||||
 | 
					          <fleckDef>PsycastPsychicEffect</fleckDef>
 | 
				
			||||||
 | 
					        </li>
 | 
				
			||||||
 | 
					        <li Class="RJW_Genes.CompProperties_AbilityMatingCall">
 | 
				
			||||||
 | 
					            <calldistance>40</calldistance>
 | 
				
			||||||
 | 
					        </li>
 | 
				
			||||||
 | 
					        <li Class="CompProperties_AbilityGiveHediff">
 | 
				
			||||||
 | 
					            <compClass>CompAbilityEffect_GiveHediff</compClass>
 | 
				
			||||||
 | 
					            <hediffDef>Hediff_Submitting</hediffDef>
 | 
				
			||||||
 | 
					            <onlyApplyToSelf>True</onlyApplyToSelf>
 | 
				
			||||||
 | 
					        </li>
 | 
				
			||||||
 | 
					     </comps>   
 | 
				
			||||||
 | 
					     <confirmationDialogText>Being Bred is not an easy business.\nThis might lead to a broken pawn, torn genitalia and hybrid-pregnancies.\nMaybe this is what you want.\nThe pawn will `submit` and e.g. Insects might cocoon him.\n\nAre you sure to proceed?</confirmationDialogText>
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					  </AbilityDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
| 
						 | 
					@ -77,4 +77,21 @@
 | 
				
			||||||
    <biostatMet>-1</biostatMet>
 | 
					    <biostatMet>-1</biostatMet>
 | 
				
			||||||
  </GeneDef>
 | 
					  </GeneDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <GeneDef ParentName="BreedingBase">
 | 
				
			||||||
 | 
							<defName>rjw_genes_mating_call</defName>
 | 
				
			||||||
 | 
							<label>Mating Call</label>
 | 
				
			||||||
 | 
							<description>This gene allows to call nearby animals and invite them for mating.</description>
 | 
				
			||||||
 | 
							<iconPath>Genes/Icons/Cocoon</iconPath>
 | 
				
			||||||
 | 
							<displayOrderInCategory>65</displayOrderInCategory>
 | 
				
			||||||
 | 
							<abilities>
 | 
				
			||||||
 | 
								<li>rjw_genes_ability_mating_call</li>
 | 
				
			||||||
 | 
							</abilities>
 | 
				
			||||||
 | 
							<descriptionHyperlinks>
 | 
				
			||||||
 | 
								<AbilityDef>rjw_genes_ability_mating_call</AbilityDef>
 | 
				
			||||||
 | 
							</descriptionHyperlinks>
 | 
				
			||||||
 | 
							<biostatCpx>2</biostatCpx>
 | 
				
			||||||
 | 
							<biostatMet>-1</biostatMet>
 | 
				
			||||||
 | 
						</GeneDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</Defs>
 | 
					</Defs>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,64 @@
 | 
				
			||||||
 | 
					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);
 | 
				
			||||||
 | 
					            DoAnimalBreedingPulse();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private void DoAnimalBreedingPulse()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (fired) { return; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            IEnumerable<Pawn> animals = this.parent.pawn.Map.mapPawns.AllPawnsSpawned.Where<Pawn>((Func<Pawn, bool>)(p => p.IsNonMutantAnimal && p.Position.InHorDistOf(this.parent.pawn.Position, Props.calldistance)));
 | 
				
			||||||
 | 
					            int breeder_counter = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            foreach (Pawn animal in animals)
 | 
				
			||||||
 | 
					            {   
 | 
				
			||||||
 | 
					                if (animal.MentalState != null && (animal.MentalState.def == MentalStateDefOf.Manhunter || animal.MentalState.def == MentalStateDefOf.ManhunterPermanent))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Log.Warning("Found an angry Animal to Fuck");
 | 
				
			||||||
 | 
					                    animal?.MentalState?.RecoverFromState();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if(xxx.is_healthy_enough(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, this.parent.pawn);
 | 
				
			||||||
 | 
					                    animal.jobs.TryTakeOrderedJob(job);
 | 
				
			||||||
 | 
					                    breeder_counter++;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            ModLog.Message($"{breeder_counter} of {animals.Count()} Animals in range are trying to breed {this.parent.pawn}");
 | 
				
			||||||
 | 
					            fired = true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -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);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -64,8 +64,10 @@
 | 
				
			||||||
    <Compile Include="Common\ModLog.cs" />
 | 
					    <Compile Include="Common\ModLog.cs" />
 | 
				
			||||||
    <Compile Include="Common\Defs\TickIntervalExtension.cs" />
 | 
					    <Compile Include="Common\Defs\TickIntervalExtension.cs" />
 | 
				
			||||||
    <Compile Include="Common\Patches\PatchImplants.cs" />
 | 
					    <Compile Include="Common\Patches\PatchImplants.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Breeding\Gene_FerventOvipositor.cs" />
 | 
					    <Compile Include="Genes\Breeding\Abilities\CompAbilityEffect_MatingCall.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Breeding\Gene_InsectIncubator.cs" />
 | 
					    <Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityMatingCall.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\Damage\Gene_Elasticity.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" />
 | 
					    <Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />
 | 
					    <Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />
 | 
				
			||||||
| 
						 | 
					@ -76,8 +78,8 @@
 | 
				
			||||||
    <Compile Include="Common\Patches\PatchGetParents.cs" />
 | 
					    <Compile Include="Common\Patches\PatchGetParents.cs" />
 | 
				
			||||||
    <Compile Include="Common\Patches\PatchPregnancyHelper.cs" />
 | 
					    <Compile Include="Common\Patches\PatchPregnancyHelper.cs" />
 | 
				
			||||||
    <Compile Include="GeneDefOf.cs" />
 | 
					    <Compile Include="GeneDefOf.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Breeding\Gene_MechBreeder.cs" />
 | 
					    <Compile Include="Genes\Breeding\Genes\Gene_MechBreeder.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Breeding\PatchMechBirth.cs" />
 | 
					    <Compile Include="Genes\Breeding\Patches\PatchMechBirth.cs" />
 | 
				
			||||||
    <Compile Include="Genes\ExtraGenitalia\Gene_Femboy.cs" />
 | 
					    <Compile Include="Genes\ExtraGenitalia\Gene_Femboy.cs" />
 | 
				
			||||||
    <Compile Include="Genes\ExtraGenitalia\Gene_UdderBreasts.cs" />
 | 
					    <Compile Include="Genes\ExtraGenitalia\Gene_UdderBreasts.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Gender\Defs\GenderFluidExtension.cs" />
 | 
					    <Compile Include="Genes\Gender\Defs\GenderFluidExtension.cs" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue