mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Merge Cumeater and follow up changes
This commit is contained in:
commit
7220accf4a
38 changed files with 1022 additions and 162 deletions
|
@ -1,10 +1,4 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
|
||||
|
@ -13,13 +7,13 @@ 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
|
||||
// Only spread pheromones if sexdrive above 1
|
||||
float sexfrequency = this.pawn.GetStatValue(StatDef.Named("SexFrequency"));
|
||||
if(sexfrequency > 1f)
|
||||
{
|
||||
|
@ -31,21 +25,23 @@ namespace RJW_Genes
|
|||
}
|
||||
}
|
||||
|
||||
//Creates an IEnumerable of all pawns which are closeby and in lineofsight, self and other pawns with aphrodisiac pheromones gene are skipped.
|
||||
// Creates 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;
|
||||
}
|
||||
}
|
||||
//IEnumerator<Pawn> enumerator = null;
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
//Applies or renews a hediff which increases sexdrive for 6 hours
|
||||
// Applies or renews a hediff which increases sexdrive for 6 hours
|
||||
private void InduceAphrodisiac(Pawn pawn, float sexfrequency)
|
||||
{
|
||||
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_aphrodisiac_pheromone);
|
||||
|
@ -68,7 +64,7 @@ namespace RJW_Genes
|
|||
}
|
||||
}
|
||||
|
||||
//Function to modify aphrodisiac strength, currently has no effect, but it's an easy hook for other modders.
|
||||
// Function to modify aphrodisiac strength, currently has no effect, but provides an easy hook for other modders and patches.
|
||||
public float ModifySexfrequency(Pawn pawn, float sexfrequency)
|
||||
{
|
||||
return sexfrequency;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue