2022-04-27 10:56:16 +00:00
|
|
|
|
using RimWorld;
|
2022-05-23 17:07:31 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2022-04-27 10:56:16 +00:00
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace RJWSexperience // Used in Menstruation with this namespace
|
|
|
|
|
{
|
|
|
|
|
public class Building_CumBucket : Building_Storage
|
|
|
|
|
{
|
2022-05-23 17:07:31 +00:00
|
|
|
|
protected float storedDecimalRemainder = 0f;
|
|
|
|
|
protected float totalGathered = 0f;
|
|
|
|
|
|
|
|
|
|
public int StoredStackCount
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (!slotGroup.HeldThings.Any())
|
|
|
|
|
return 0;
|
|
|
|
|
return slotGroup.HeldThings.Select(thing => thing.stackCount).Aggregate((sum, x) => sum + x);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-27 10:56:16 +00:00
|
|
|
|
|
|
|
|
|
public override void ExposeData()
|
|
|
|
|
{
|
2022-05-23 17:07:31 +00:00
|
|
|
|
Scribe_Values.Look(ref storedDecimalRemainder, "storedcum", 0f);
|
|
|
|
|
Scribe_Values.Look(ref totalGathered, "totalgathered", 0f);
|
2022-04-27 10:56:16 +00:00
|
|
|
|
base.ExposeData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string GetInspectString()
|
|
|
|
|
{
|
2022-05-23 17:07:31 +00:00
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
string baseString = base.GetInspectString();
|
|
|
|
|
if (!baseString.NullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
stringBuilder.AppendLine(baseString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stringBuilder.Append(Keyed.RSTotalGatheredCum).AppendFormat("{0:0.##}ml", totalGathered);
|
|
|
|
|
|
2023-03-24 15:22:54 +00:00
|
|
|
|
if (SexperienceMod.Settings.DevMode)
|
2022-05-23 17:07:31 +00:00
|
|
|
|
{
|
|
|
|
|
stringBuilder.AppendLine();
|
2023-04-17 11:34:35 +00:00
|
|
|
|
stringBuilder.Append("[Debug] stored: ").Append(StoredStackCount).AppendLine();
|
|
|
|
|
stringBuilder.Append("[Debug] storedDecimalRemainder: ").Append(storedDecimalRemainder);
|
2022-05-23 17:07:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stringBuilder.ToString();
|
2022-04-27 10:56:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddCum(float amount)
|
|
|
|
|
{
|
2023-04-17 11:34:35 +00:00
|
|
|
|
AddCum(amount, RsDefOf.Thing.GatheredCum);
|
2022-04-27 10:56:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddCum(float amount, ThingDef cumDef)
|
|
|
|
|
{
|
|
|
|
|
Thing cum = ThingMaker.MakeThing(cumDef);
|
|
|
|
|
AddCum(amount, cum);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddCum(float amount, Thing cum)
|
|
|
|
|
{
|
2022-05-23 17:07:31 +00:00
|
|
|
|
storedDecimalRemainder += amount;
|
|
|
|
|
totalGathered += amount;
|
|
|
|
|
int num = (int)storedDecimalRemainder;
|
2022-04-27 10:56:16 +00:00
|
|
|
|
|
|
|
|
|
cum.stackCount = num;
|
|
|
|
|
if (cum.stackCount > 0 && !GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res))
|
|
|
|
|
{
|
2023-04-17 11:34:35 +00:00
|
|
|
|
FilthMaker.TryMakeFilth(PositionHeld, Map, RsDefOf.Thing.FilthCum, num);
|
2022-04-27 10:56:16 +00:00
|
|
|
|
}
|
2022-05-23 17:07:31 +00:00
|
|
|
|
storedDecimalRemainder -= num;
|
2022-04-27 10:56:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|