mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Merge and aphrodisiac pheromones fixes
This commit is contained in:
		
							parent
							
								
									982339a84e
								
							
						
					
					
						commit
						84c4587a18
					
				
					 7 changed files with 14 additions and 48 deletions
				
			
		| 
						 | 
				
			
			@ -89,12 +89,8 @@ namespace RJW_Genes
 | 
			
		|||
		public static readonly GeneDef rjw_genes_succubus_tail;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_succubus_wings;
 | 
			
		||||
 | 
			
		||||
		// Others & Non-Genes
 | 
			
		||||
		public static readonly GeneDef rjw_genes_youth_fountain;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_sex_age_drain;
 | 
			
		||||
		public static readonly HediffDef rjw_genes_orgasm_rush_hediff;
 | 
			
		||||
 | 
			
		||||
		public static readonly XenotypeDef Succubus;
 | 
			
		||||
		public static readonly XenotypeDef rjw_genes_succubus;
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,13 +49,14 @@ namespace RJW_Genes
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            //Spawn succubus at pawn and initiate sex
 | 
			
		||||
            Pawn succubus = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDef.Named("Succubus"), faction, PawnGenerationContext.NonPlayer, -1, 
 | 
			
		||||
            Pawn succubus = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDef.Named("rjw_genes_succubus"), faction, PawnGenerationContext.NonPlayer, -1, 
 | 
			
		||||
                false, false, false, true, false, 1f, false, true, false, true, true, false, false, false, false, 0f, 0f, null, 1f, null, null, 
 | 
			
		||||
                null, null, null, null, null, null, null, null, null, null, false, false, false, false, null, null, null, null, null, 0f,
 | 
			
		||||
                DevelopmentalStage.Adult, null, null, null, false));
 | 
			
		||||
            succubus.SetFaction(null, null);
 | 
			
		||||
            GenSpawn.Spawn(succubus, loc, map, WipeMode.Vanish);
 | 
			
		||||
            
 | 
			
		||||
            //Broken for now
 | 
			
		||||
            //Sends letter
 | 
			
		||||
            //string value = succubus.DevelopmentalStage.Child() ? "FeralChild".Translate().ToString() : succubus.KindLabel;
 | 
			
		||||
            //TaggedString value2 = succubus.DevelopmentalStage.Child() ? "Child".Translate() : "Person".Translate();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,11 +13,11 @@ namespace RJW_Genes
 | 
			
		|||
    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.
 | 
			
		||||
        //Summary once every one hour check for all pawns nearby and in line of sight (same room) and add/renew a hediff which lasts for 1 hour.
 | 
			
		||||
        public override void Tick()
 | 
			
		||||
        {
 | 
			
		||||
            base.Tick();
 | 
			
		||||
            if (this.pawn.IsHashIntervalTick(2500))
 | 
			
		||||
            if (this.pawn.IsHashIntervalTick(2500) && this.pawn.Map != null)
 | 
			
		||||
            {
 | 
			
		||||
                //Only spread pheromones if sexdrive above 1
 | 
			
		||||
                float sexfrequency = this.pawn.GetStatValue(StatDef.Named("SexFrequency"));
 | 
			
		||||
| 
						 | 
				
			
			@ -31,12 +31,12 @@ namespace RJW_Genes
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //Creatus an IEnumerable of all pawns which are closeby and in lineofsight, self and other pawns with aphrodisiac pheromones gene are skipped.
 | 
			
		||||
        //Creatus an IEnumerable of all pawns which are closeby and in lineofsight, self and other pawns with aphrodisiac pheromones gene are skipped (to prevent loops).
 | 
			
		||||
        private IEnumerable<Pawn> AffectedPawns(IntVec3 pos, Map map)
 | 
			
		||||
        {
 | 
			
		||||
            foreach (Pawn pawn in map.mapPawns.AllPawns)
 | 
			
		||||
            {
 | 
			
		||||
                if (this.pawn != null && pawn != this.pawn && pos.DistanceTo(pawn.Position) < 5 && GenSight.LineOfSight(pos, pawn.Position, pawn.Map) && !GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
 | 
			
		||||
                if (pawn != null && this.pawn != null && pawn != this.pawn && pos.DistanceTo(pawn.Position) < 5 && GenSight.LineOfSight(pos, pawn.Position, pawn.Map) && !GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
 | 
			
		||||
                {
 | 
			
		||||
                    yield return pawn;
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +45,7 @@ namespace RJW_Genes
 | 
			
		|||
            yield break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //Applies er renews a hediff which increases sexdrive for 6 hours
 | 
			
		||||
        //Applies or renews a hediff which increases sexdrive for 1 hours
 | 
			
		||||
        private void InduceAphrodisiac(Pawn pawn, float sexfrequency)
 | 
			
		||||
        {
 | 
			
		||||
            Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Aphrodisiac_Pheromone);
 | 
			
		||||
| 
						 | 
				
			
			@ -59,9 +59,6 @@ namespace RJW_Genes
 | 
			
		|||
                Hediff aphrodisiac = HediffMaker.MakeHediff(HediffDefOf.Aphrodisiac_Pheromone, pawn);
 | 
			
		||||
                foreach (StatModifier stat in aphrodisiac.CurStage.statFactors)
 | 
			
		||||
                {
 | 
			
		||||
                    //Log.Message(pawn.Name.ToString());
 | 
			
		||||
                    //Log.Message(stat.stat.defName);
 | 
			
		||||
                    //Log.Message(stat.value.ToString());
 | 
			
		||||
                    if (stat.stat.defName == "SexFrequency")
 | 
			
		||||
                    {
 | 
			
		||||
                        stat.value = ModifySexfrequency(pawn, sexfrequency);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue