replaced compinducelactation with hediffcomp; cleaner

todo:
add abilitydef to hucow handler to begin inducing lactation; give lactation induction hediff to recipient pawn
add thoughtdef w/ thoughtworker_hediff to give pawns thoughts on inducing lactation
This commit is contained in:
c0ffee 2022-10-14 18:10:00 -07:00
parent 1d6ecb3f95
commit 5b4b203d13
19 changed files with 233 additions and 70 deletions

View file

@ -36,13 +36,15 @@ namespace CRIALactation
public override bool HasJobOnThing(Pawn p, Thing t, bool forced = false)
{
Pawn pawn2 = t as Pawn;
if(pawn2?.TryGetComp<CompInduceLactation>() == null)
if(pawn2?.health?.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.InducingLactation) == null)
{
return false;
}
CompInduceLactation c = pawn2.TryGetComp<CompInduceLactation>();
Hediff lactationInductionHediff = pawn2?.health?.hediffSet?.GetFirstHediffOfDef(HediffDefOf_Milk.InducingLactation);
if (lactationInductionHediff == null) return false;
return p != pawn2 && c.isActive && c.CanMassage && !pawn2.Downed && !pawn2.Drafted && !pawn2.InAggroMentalState && !pawn2.IsFormingCaravan() && pawn2.CanCasuallyInteractNow(false, true, false) && p.CanReserve(pawn2, 1, -1, null, forced);
HediffComp_LactationInduction lactInductComp = lactationInductionHediff.TryGetComp<HediffComp_LactationInduction>();
return p != pawn2 && lactInductComp.canMassage() && !pawn2.Downed && !pawn2.Drafted && !pawn2.InAggroMentalState && !pawn2.IsFormingCaravan() && pawn2.CanCasuallyInteractNow(false, true, false) && p.CanReserve(pawn2, 1, -1, null, forced);
}