Compatibility with lutepickle's menstruation

This commit is contained in:
amevarashi 2022-03-20 19:15:55 +05:00
parent 4dc352ad75
commit 7ebc0e4878
2 changed files with 22 additions and 20 deletions

View File

@ -4,9 +4,8 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Verse;
using Verse.AI;
namespace RJWSexperience.ExtensionMethods
namespace RJWSexperience
{
public static class PawnExtensions
{
@ -138,24 +137,6 @@ namespace RJWSexperience.ExtensionMethods
}
}
public static Building_CumBucket FindClosestBucket(this Pawn pawn)
{
List<Building> buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket);
Dictionary<Building, float> targets = new Dictionary<Building, float>();
if (!buckets.NullOrEmpty()) for (int i = 0; i < buckets.Count; i++)
{
if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None))
{
targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position));
}
}
if (!targets.NullOrEmpty())
{
return (Building_CumBucket)targets.MinBy(x => x.Value).Key;
}
return null;
}
public static void AteCum(this Pawn pawn, float amount, bool doDrugEffect = false)
{
pawn.records.AddTo(VariousDefOf.NumofEatenCum, 1);

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using rjw;
using RimWorld;
using Verse;
using Verse.AI;
using UnityEngine;
using rjw.Modules.Interactions.Objects;
using rjw.Modules.Interactions.Helpers;
@ -193,5 +194,25 @@ namespace RJWSexperience
pawn.records?.AddTo(recordforpawn, 1);
partner.records?.AddTo(recordforpartner, 1);
}
// Moved this method back because of Menstruation
public static Building_CumBucket FindClosestBucket(this Pawn pawn)
{
List<Building> buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket);
Dictionary<Building, float> targets = new Dictionary<Building, float>();
if (!buckets.NullOrEmpty()) for (int i = 0; i < buckets.Count; i++)
{
if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None))
{
targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position));
}
}
if (!targets.NullOrEmpty())
{
return (Building_CumBucket)targets.MinBy(x => x.Value).Key;
}
return null;
}
}
}