rjw-genes/1.6/Source/CumpilationLoader/Patches/Patch_ProcessingCumbucket.cs
Telanda-DDS dde1c98b18 - Incremented version to 2.5.1
- Removed DDS Files
- Added Initial Support for Rimworld 1.6
- Added Additional mod requirement to PatchBSShared.xml to prevent premature loading.
- Refactored Cumpilation integration to make it optional rather then a Required Mod.
- Disabled succubus tail interactions pending rewrite for RJW's new interactions system.
- Disabled Quirks pending rewrite RJW separating them into their own mod.
2025-07-17 21:07:51 +10:00

63 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using rjw;
using Verse;
using RJW_Genes;
namespace CumpilationPatcher
{
internal class Patch_ProcessingCumbucket
{
//Patches the 'empty' SpawnCum method in 'JobDriver_ProcessingCumbucket'
public static void PostFix(Pawn pawn, IntVec3 cell, Map map)
{
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_filled_living_cumbucket);
if (hediff == null)
{
ModLog.Warning($"{pawn} has the JobDriver_ProcessCumbucket but does not have the Hediff for filled cumbucket.");
return;
}
var storage = hediff.TryGetComp<Cumpilation.Cumflation.HediffComp_SourceStorage>();
var random_entry = storage.sources.RandomElementByWeight(p => p.amount);
ThingDef ToSpawn = random_entry.fluid.consumable == null ? Cumpilation.DefOfs.Cumpilation_Cum : random_entry.fluid.consumable;
ThingDef cumDef = Cumpilation.DefOfs.Cumpilation_Cum;
// Case 1: "Normal Severity", just puke out a bit of cum here and there.
if (hediff.Severity <= 10)
{
Thing cum = ThingMaker.MakeThing(cumDef);
cum.Position = cell;
int stacks = Math.Max(1, (int)(hediff.Severity * 1.5));
stacks = Math.Min(stacks, 75); // 75 is the default max stacksize ...
cum.stackCount = stacks;
cum.SpawnSetup(map, false);
hediff.Severity -= (stacks / 50);
}
else
// Case 2: Reserviour mode, put out a lot of cum at once but less often.
{
int stacks = Math.Max(1, (int)(hediff.Severity * 1.5));
while (stacks > 0)
{
Thing cum = ThingMaker.MakeThing(cumDef);
cum.Position = cell;
var curStacks = Math.Min(stacks, 75); // 75 is the default max stacksize ...
cum.stackCount = stacks;
cum.SpawnSetup(map, false);
hediff.Severity -= (curStacks / 50);
stacks -= curStacks;
}
}
}
}
}