2022-07-12 22:49:55 +00:00
|
|
|
|
using Milk;
|
2021-06-10 12:06:05 +00:00
|
|
|
|
using RJW_Menstruation;
|
2022-07-12 22:49:55 +00:00
|
|
|
|
using Verse;
|
2021-06-10 12:06:05 +00:00
|
|
|
|
|
|
|
|
|
namespace MilkModule
|
|
|
|
|
{
|
2021-06-16 12:53:52 +00:00
|
|
|
|
public class JobDriver_MilkSelf_MC : JobDriver_MilkSelf
|
2021-06-10 12:06:05 +00:00
|
|
|
|
{
|
2021-06-16 12:53:52 +00:00
|
|
|
|
HumanCompHasGatherableBodyResource comp;
|
|
|
|
|
HediffComp_Breast breastcomp;
|
|
|
|
|
|
|
|
|
|
protected override float Fullness
|
2021-06-10 12:06:05 +00:00
|
|
|
|
{
|
2021-06-16 12:53:52 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
2021-07-30 14:06:05 +00:00
|
|
|
|
return comp?.Fullness ?? 0f;
|
2021-06-16 12:53:52 +00:00
|
|
|
|
}
|
2021-06-10 12:06:05 +00:00
|
|
|
|
}
|
2021-06-16 12:53:52 +00:00
|
|
|
|
|
|
|
|
|
protected override void PreMakeNewToils()
|
2021-06-10 12:06:05 +00:00
|
|
|
|
{
|
2021-06-16 12:53:52 +00:00
|
|
|
|
comp = GetMilkComp(pawn);
|
|
|
|
|
breastcomp = pawn.GetBreastComp();
|
|
|
|
|
}
|
2021-06-10 12:06:05 +00:00
|
|
|
|
|
2021-06-16 12:53:52 +00:00
|
|
|
|
protected override void Gathered()
|
|
|
|
|
{
|
2021-07-30 14:06:05 +00:00
|
|
|
|
comp?.Gathered(pawn);
|
2021-06-16 12:53:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PostTickAction()
|
2022-08-31 15:03:47 +00:00
|
|
|
|
{
|
|
|
|
|
breastcomp?.AdjustNippleProgress(Rand.Range(0.0f, 0.000005f) * Configurations.MaxNippleIncrementFactor);
|
2021-06-10 12:06:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-16 12:53:52 +00:00
|
|
|
|
|
2021-06-10 12:06:05 +00:00
|
|
|
|
public static HumanCompHasGatherableBodyResource GetMilkComp(Pawn pawn)
|
|
|
|
|
{
|
2022-03-18 14:31:17 +00:00
|
|
|
|
HumanCompHasGatherableBodyResource result;
|
2021-06-10 12:06:05 +00:00
|
|
|
|
if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Heavy_Lactating_Permanent))
|
|
|
|
|
{
|
|
|
|
|
result = pawn.TryGetComp<CompHyperMilkableHuman>();
|
2022-07-12 22:49:55 +00:00
|
|
|
|
|
2021-06-10 12:06:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = pawn.TryGetComp<CompMilkableHuman>();
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-06-16 12:53:52 +00:00
|
|
|
|
|
2021-06-10 12:06:05 +00:00
|
|
|
|
}
|
2021-06-16 12:53:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public class JobDriver_HumanMilkSelf : JobDriver
|
|
|
|
|
//{
|
|
|
|
|
// const float milkingTime = 250f;//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()
|
|
|
|
|
// {
|
|
|
|
|
//
|
|
|
|
|
// HumanCompHasGatherableBodyResource Comp = GetMilkComp(pawn);
|
|
|
|
|
// HediffComp_Breast breastcomp = pawn.GetBreastComp();
|
|
|
|
|
// this.FailOn(delegate
|
|
|
|
|
// {
|
|
|
|
|
// return !(Comp.Fullness > 0.01f);
|
|
|
|
|
// });
|
|
|
|
|
// Toil milking = Toils_General.Wait((int)(50 + milkingTime * Comp.Fullness), TargetIndex.None);//duration of
|
|
|
|
|
//
|
|
|
|
|
// milking.WithProgressBarToilDelay(TargetIndex.A);
|
|
|
|
|
// milking.tickAction = delegate ()
|
|
|
|
|
// {
|
|
|
|
|
// if (breastcomp != null)
|
|
|
|
|
// {
|
|
|
|
|
// breastcomp.AdjustAreolaSize(Rand.Range(0.0f,0.0001f * Configurations.NipplePermanentTransitionVariance));
|
|
|
|
|
// breastcomp.AdjustNippleSize(Rand.Range(0.0f,0.0001f * Configurations.NipplePermanentTransitionVariance));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// };
|
|
|
|
|
// yield return milking;
|
|
|
|
|
// yield return new Toil()
|
|
|
|
|
// {
|
|
|
|
|
// initAction = delegate ()
|
|
|
|
|
// {
|
|
|
|
|
// Comp.Gathered(pawn);
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// //yield return excreting;
|
|
|
|
|
// yield break;
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// public static HumanCompHasGatherableBodyResource GetMilkComp(Pawn pawn)
|
|
|
|
|
// {
|
|
|
|
|
// HumanCompHasGatherableBodyResource result;
|
|
|
|
|
// if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Heavy_Lactating_Permanent))
|
|
|
|
|
// {
|
|
|
|
|
// result = pawn.TryGetComp<CompHyperMilkableHuman>();
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// result = pawn.TryGetComp<CompMilkableHuman>();
|
|
|
|
|
// }
|
|
|
|
|
// return result;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//}
|
2022-07-12 22:49:55 +00:00
|
|
|
|
|
2021-06-10 12:06:05 +00:00
|
|
|
|
|
|
|
|
|
}
|