mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Rename source folder
This commit is contained in:
parent
0a412a0060
commit
a4c046a841
55 changed files with 0 additions and 0 deletions
77
Source/RJWSexperience/Cum/Building_Cumbucket.cs
Normal file
77
Source/RJWSexperience/Cum/Building_Cumbucket.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
using RimWorld;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience // Used in Menstruation with this namespace
|
||||
{
|
||||
public class Building_CumBucket : Building_Storage
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
Scribe_Values.Look(ref storedDecimalRemainder, "storedcum", 0f);
|
||||
Scribe_Values.Look(ref totalGathered, "totalgathered", 0f);
|
||||
base.ExposeData();
|
||||
}
|
||||
|
||||
public override string GetInspectString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
string baseString = base.GetInspectString();
|
||||
if (!baseString.NullOrEmpty())
|
||||
{
|
||||
stringBuilder.AppendLine(baseString);
|
||||
}
|
||||
|
||||
stringBuilder.Append(Keyed.RSTotalGatheredCum).AppendFormat("{0:0.##}ml", totalGathered);
|
||||
|
||||
if (SexperienceMod.Settings.Debug.DevMode)
|
||||
{
|
||||
stringBuilder.AppendLine();
|
||||
stringBuilder.AppendLine($"[Debug] stored: {StoredStackCount}");
|
||||
stringBuilder.Append($"[Debug] storedDecimalRemainder: {storedDecimalRemainder}");
|
||||
}
|
||||
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
public void AddCum(float amount)
|
||||
{
|
||||
AddCum(amount, VariousDefOf.GatheredCum);
|
||||
}
|
||||
|
||||
public void AddCum(float amount, ThingDef cumDef)
|
||||
{
|
||||
Thing cum = ThingMaker.MakeThing(cumDef);
|
||||
AddCum(amount, cum);
|
||||
}
|
||||
|
||||
public void AddCum(float amount, Thing cum)
|
||||
{
|
||||
storedDecimalRemainder += amount;
|
||||
totalGathered += amount;
|
||||
int num = (int)storedDecimalRemainder;
|
||||
|
||||
cum.stackCount = num;
|
||||
if (cum.stackCount > 0 && !GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res))
|
||||
{
|
||||
FilthMaker.TryMakeFilth(PositionHeld, Map, VariousDefOf.FilthCum, num);
|
||||
}
|
||||
storedDecimalRemainder -= num;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue