WorkGiver to collect cum to bucket

This commit is contained in:
amevarashi 2022-05-03 10:09:29 +05:00
parent 0edd830a2b
commit 3807441418
4 changed files with 55 additions and 32 deletions

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<WorkGiverDef>
<defName>CleanSelfwithBucket</defName>
<label>collect cum into a bucket</label>
<giverClass>RJWSexperience.Cum.WorkGiver_CleanSelfWithBucket</giverClass>
<workType>BasicWorker</workType>
<verb>collect cum into a</verb>
<gerund>collecting cum into a</gerund>
<scanCells>false</scanCells>
<priorityInType>12</priorityInType><!-- slightly higher than RJW CleanSelf-->
<nonColonistsCanDo>true</nonColonistsCanDo>
<requiredCapacities>
<li>Manipulation</li>
</requiredCapacities>
</WorkGiverDef>
</Defs>

View file

@ -0,0 +1,37 @@
using RimWorld;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using Verse;
using Verse.AI;
namespace RJWSexperience.Cum
{
public class WorkGiver_CleanSelfWithBucket : WorkGiver_Scanner
{
public override ThingRequest PotentialWorkThingRequest => ThingRequest.ForDef(VariousDefOf.CumBucket);
public override PathEndMode PathEndMode => PathEndMode.ClosestTouch;
public override bool ShouldSkip(Pawn pawn, bool forced = false)
{
return !pawn.health.hediffSet.HasHediff(RJW_SemenoOverlayHediffDefOf.Hediff_Bukkake);
}
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
{
if (!(t is Building_CumBucket bucket))
return false;
List<Thing> thingsInBucket = bucket.Map.thingGrid.ThingsListAt(bucket.Position);
int stackInBucket = thingsInBucket.Select(thing => thing.stackCount).Aggregate((sum, x) => sum + x);
return stackInBucket < VariousDefOf.GatheredCum.stackLimit;
}
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
{
return JobMaker.MakeJob(VariousDefOf.CleanSelfwithBucket, pawn, t);
}
}
}

View file

@ -1,9 +1,6 @@
using HarmonyLib;
using RimWorld;
using rjw;
using System;
using System.Collections.Generic;
using UnityEngine;
using Verse;
namespace RJWSexperience
@ -20,33 +17,4 @@ namespace RJWSexperience
__result.AddVirginTrait();
}
}
[HarmonyPatch(typeof(FloatMenuMakerMap), "AddHumanlikeOrders")]
public static class HumanlikeOrder_Patch
{
public static void Postfix(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts)
{
var targets = GenUI.TargetsAt(clickPos, TargetingParameters.ForBuilding());
if (pawn.health.hediffSet.HasHediff(RJW_SemenoOverlayHediffDefOf.Hediff_Bukkake))
foreach (LocalTargetInfo t in targets)
{
if (t.Thing is Building_CumBucket building)
{
opts.AddDistinct(MakeMenu(pawn, building));
break;
}
}
}
public static FloatMenuOption MakeMenu(Pawn pawn, LocalTargetInfo target)
{
FloatMenuOption option = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(Keyed.RS_FloatMenu_CleanSelf, delegate ()
{
pawn.jobs.TryTakeOrderedJob(new Verse.AI.Job(VariousDefOf.CleanSelfwithBucket, null, target, target.Cell));
}, MenuOptionPriority.Low), pawn, target);
return option;
}
}
}

View file

@ -21,6 +21,7 @@ namespace RJWSexperience
public static readonly RecordDef SexPartnerCount = DefDatabase<RecordDef>.GetNamed("SexPartnerCount");
public static readonly RecordDef OrgasmCount = DefDatabase<RecordDef>.GetNamed("OrgasmCount");
public static readonly SkillDef SexSkill = DefDatabase<SkillDef>.GetNamed("Sex");
public static readonly ThingDef CumBucket = DefDatabase<ThingDef>.GetNamed("CumBucket");
public static readonly ThingDef GatheredCum = DefDatabase<ThingDef>.GetNamed("GatheredCum");
public static readonly ThingDef FilthCum = ThingDef.Named("FilthCum");
public static readonly HediffDef CumAddiction = DefDatabase<HediffDef>.GetNamed("CumAddiction");