mirror of
https://gitgud.io/Ed86/rjw-cum.git
synced 2024-08-15 00:43:40 +00:00
support for 1.4
This commit is contained in:
parent
358b0d4f2e
commit
b943cb55c6
39 changed files with 1912 additions and 1 deletions
53
1.4/Source/Mod/JobDrivers/JobDriver_CleanSelf.cs
Normal file
53
1.4/Source/Mod/JobDrivers/JobDriver_CleanSelf.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace rjwcum
|
||||
{
|
||||
class JobDriver_CleanSelf : JobDriver
|
||||
{
|
||||
float cleanAmount = 1f;//severity of a single cumHediff removed per cleaning-round; 1f = remove entirely
|
||||
int cleaningTime = 120;//ticks - 120 = 2 real seconds, 3 in-game minutes
|
||||
|
||||
public override bool TryMakePreToilReservations(bool errorOnFailed)
|
||||
{
|
||||
return pawn.Reserve(pawn, job, 1, -1, null, errorOnFailed);
|
||||
}
|
||||
|
||||
protected override IEnumerable<Toil> MakeNewToils()
|
||||
{
|
||||
this.FailOn(delegate
|
||||
{
|
||||
List<Hediff> hediffs = pawn.health.hediffSet.hediffs;
|
||||
return !hediffs.Exists(x => x.def == HediffDefOf.Hediff_CumController);//fail if cum disappears - means that also all the cum is gone
|
||||
});
|
||||
Toil cleaning = Toils_General.Wait(cleaningTime, TargetIndex.None);//duration of
|
||||
cleaning.WithProgressBarToilDelay(TargetIndex.A);
|
||||
|
||||
yield return cleaning;
|
||||
yield return new Toil()
|
||||
{
|
||||
initAction = delegate ()
|
||||
{
|
||||
//get one of the cum hediffs, reduce its severity
|
||||
Hediff hediff = pawn.health.hediffSet.hediffs.Find(x => (x.def == HediffDefOf.Hediff_Cum || x.def == HediffDefOf.Hediff_InsectSpunk || x.def == HediffDefOf.Hediff_MechaFluids));
|
||||
if (hediff != null)
|
||||
{
|
||||
if (hediff.Severity >= 0.5)
|
||||
{
|
||||
if (hediff.def == HediffDefOf.Hediff_InsectSpunk)
|
||||
{
|
||||
Thing jelly = ThingMaker.MakeThing(ThingDefOf.InsectJelly);
|
||||
jelly.SetForbidden(true, false);
|
||||
GenPlace.TryPlaceThing(jelly, pawn.PositionHeld, pawn.MapHeld, ThingPlaceMode.Near);
|
||||
}
|
||||
}
|
||||
hediff.Severity -= cleanAmount;
|
||||
}
|
||||
}
|
||||
};
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue