mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Added more checks to pheromone, fixes #25
This commit is contained in:
parent
90204f9134
commit
bb6fbb67d9
1 changed files with 19 additions and 3 deletions
|
@ -39,9 +39,25 @@ namespace RJW_Genes
|
||||||
{
|
{
|
||||||
foreach (Pawn pawn in map.mapPawns.AllPawns)
|
foreach (Pawn pawn in map.mapPawns.AllPawns)
|
||||||
{
|
{
|
||||||
if (pawn != null && this.pawn != null && pawn != this.pawn
|
// Return for trivial errors
|
||||||
&& pos.DistanceTo(pawn.Position) < APHRODISIAC_DISTANCE && GenSight.LineOfSight(pos, pawn.Position, pawn.Map)
|
if (pawn == null || this.pawn == null || pawn == this.pawn)
|
||||||
&& !GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
|
continue;
|
||||||
|
// Check for position-existance
|
||||||
|
if (pawn.Position == null || pos == null || pawn.Map == null)
|
||||||
|
continue;
|
||||||
|
// Do nothing if pawn is carried
|
||||||
|
if (pawn.CarriedBy != null)
|
||||||
|
continue;
|
||||||
|
// Do nothing if Pawn is Baby or Child (#25)
|
||||||
|
if (!pawn.ageTracker.Adult)
|
||||||
|
continue;
|
||||||
|
// Do nothing for pawns that also have pheromones
|
||||||
|
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Actual Logic:
|
||||||
|
// Pawn qualifies in right distance and needs line of sight.
|
||||||
|
if (pos.DistanceTo(pawn.Position) < APHRODISIAC_DISTANCE && GenSight.LineOfSight(pos, pawn.Position, pawn.Map))
|
||||||
{
|
{
|
||||||
yield return pawn;
|
yield return pawn;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue