rjw-genes/1.6/Source/CumpilationLoader/Patches/Patch_JobGiver_GetLifeForce.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

39 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
using Verse.AI;
namespace CumpilationPatcher
{
internal class Patch_JobGiver_GetLifeForce
{
//Patches the 'empty' GetStoredCum method in 'JobGiver_GetLifeForce'
public static void PostFix(Pawn pawn, ref Thing __result)
{
Thing carriedThing = pawn.carryTracker.CarriedThing;
ThingDef cumThingDef = Cumpilation.DefOfs.Cumpilation_Cum;
if (cumThingDef == null) { return; } //__result is already null;
if (carriedThing != null && carriedThing.def == cumThingDef)
{
__result = carriedThing;
return;
}
for (int i = 0; i < pawn.inventory.innerContainer.Count; i++)
{
if (pawn.inventory.innerContainer[i].def == cumThingDef)
{
__result = pawn.inventory.innerContainer[i];
return;
}
}
__result = GenClosest.ClosestThing_Global_Reachable(pawn.Position, pawn.Map, pawn.Map.listerThings.ThingsOfDef(cumThingDef), PathEndMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false, false, false), 9999f, (Thing t) => pawn.CanReserve(t, 1, -1, null, false) && !t.IsForbidden(pawn), null);
return;
}
}
}