coffees-rjw-ideology-addons/CRIALactation/Source/LactationUtility.cs

98 lines
3.3 KiB
C#
Raw Normal View History

2021-07-26 04:06:00 +00:00
using Milk;
2021-07-26 15:19:49 +00:00
using rjw;
2021-07-26 04:06:00 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace CRIALactation
{
public static class LactationUtility
{
public static bool IsLactating(Pawn p)
{
return
p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Natural, false) ||
p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Drug, false) ||
p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Permanent, false) ||
2021-11-17 21:47:10 +00:00
p.health.hediffSet.HasHediff(HediffDefOf_Milk.Heavy_Lactating_Permanent, false);
2021-11-17 21:01:36 +00:00
2021-07-26 04:06:00 +00:00
}
2021-07-26 15:19:49 +00:00
public static bool HasMilkableBreasts(Pawn p)
{
2021-08-01 23:17:04 +00:00
if (p.TryGetComp<CompMilkableHuman>() == null) return false;
2023-02-06 03:05:01 +00:00
if (Genital_Helper.has_breasts(p) && (MilkSettings.flatChestGivesMilk || !Genital_Helper.has_male_breasts(p)))
2021-07-26 15:19:49 +00:00
{
return true;
}
return false;
}
public static void StartLactating(Pawn p, bool natural)
{
Hediff lactating = HediffMaker.MakeHediff(HediffDefOf_Milk.Lactating_Natural, p, null);
2023-02-06 03:05:01 +00:00
lactating.Severity = 1;// Rand.Value;
p.health.AddHediff(lactating, null, null, null);
//just adding to base body, not to breasts. Just in case the target has multiple breasts so to not confuse
//p.health.AddHediff(lactating, Genital_Helper.get_breastsBPR(p));
2021-07-26 15:19:49 +00:00
}
2021-07-30 01:33:08 +00:00
2021-08-02 18:55:46 +00:00
public static void StopBeingHucow(Pawn p)
{
p.health.RemoveHediff(p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.Hucow, false));
}
public static bool IsHucow(Pawn p)
{
return p.health.hediffSet.HasHediff(HediffDefOf_Milk.Hucow);
}
2021-07-30 01:33:08 +00:00
public static bool isMassageable(Pawn p)
{
Hediff lactationInductionHediff = p.health?.hediffSet?.GetFirstHediffOfDef(HediffDefOf_Milk.InducingLactation);
2023-02-06 03:05:01 +00:00
Hediff lactationInductionCooldownHediff = p.health?.hediffSet?.GetFirstHediffOfDef(HediffDefOf_Milk.InducingLactationCooldown);
if (lactationInductionHediff == null) return false;
2023-02-06 03:05:01 +00:00
if (lactationInductionCooldownHediff != null) return false;
2021-07-30 01:33:08 +00:00
return true;
2021-07-30 01:33:08 +00:00
}
2021-08-02 18:55:46 +00:00
public static void ExtendLactationDuration(Pawn p)
{
var drugLact = p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.Lactating_Drug);
if(drugLact != null)
{
2023-02-06 03:05:01 +00:00
drugLact.Severity = 1;
//drugLact.TryGetComp<HediffComp_Disappears>().ticksToDisappear = 1800000;
2021-08-02 18:55:46 +00:00
}
var naturalLact = p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.Lactating_Natural);
if (naturalLact != null)
{
2023-02-06 03:05:01 +00:00
naturalLact.Severity = 1;
//naturalLact.TryGetComp<HediffComp_Disappears>().ticksToDisappear = 1800000;
2021-08-02 18:55:46 +00:00
}
2023-02-06 03:05:01 +00:00
if (ModsConfig.BiotechActive)
{
var hediffLactBT = p.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Lactating"));
if (hediffLactBT != null)
{
hediffLactBT.Severity = 1;
}
}
2021-08-02 18:55:46 +00:00
}
2021-07-26 04:06:00 +00:00
}
}