changes to lactation hediffs:

prisoners can be milked
pawns spawn lactating by default with hucow precept
This commit is contained in:
dominiclopez391 2021-11-15 14:58:49 -08:00
parent f715f352eb
commit a5d5cc1d44
7 changed files with 38 additions and 54 deletions

View file

@ -84,7 +84,7 @@
<Compile Include="Source\JobDrivers\JobDriver_MassageBreasts.cs" />
<Compile Include="Source\LactationUtility.cs" />
<Compile Include="Source\PreceptDefOf\PreceptDefOf_Lactation.cs" />
<Compile Include="Source\Precepts\Precept_Lactation.cs" />
<Compile Include="Source\Precepts\PreceptComp_Lactation.cs" />
<Compile Include="Source\RoleEffects\RoleEffect_Hucow.cs" />
<Compile Include="Source\RoleRequirements\RoleRequirement_Lactating.cs" />
<Compile Include="Source\StatDefOf\StatDefOf_Lactation.cs" />

View file

@ -18,6 +18,7 @@
<displayOrderInImpact>100</displayOrderInImpact>
<description>Milk from breasts is creamy and delicious. It should be produced and consumed on a regular basis. Lactating colonists will produce double the normal amount of milk.</description>
<comps>
<li Class="CRIALactation.PreceptComp_Lactation" />
<li Class="PreceptComp_SituationalThought">
<thought>Lactating_Essential</thought>
<description>Sizeable breasts must produce milk</description>

View file

@ -36,7 +36,7 @@ namespace CRIALactation
public static void StartLactating(Pawn p, bool natural)
{
Hediff lactating = HediffMaker.MakeHediff(natural ? HediffDefOf_Milk.Lactating_Natural : HediffDefOf_Milk.Lactating_Drug, p, null);
Hediff lactating = HediffMaker.MakeHediff(HediffDefOf_Milk.Lactating_Natural, p, null);
lactating.Severity = Rand.Value;
p.health.AddHediff(lactating, Genital_Helper.get_breastsBPR(p));
}

View file

@ -0,0 +1,33 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using rjw;
using Milk;
using UnityEngine;
namespace CRIALactation
{
public class PreceptComp_Lactation : PreceptComp
{
public override void Notify_MemberGenerated(Pawn pawn, Precept precept)
{
if(precept.def == PreceptDefOf_Lactation.Lactating_Essential &&
LactationUtility.HasMilkableBreasts(pawn))
{
if (!LactationUtility.IsLactating(pawn))
{
LactationUtility.StartLactating(pawn, pawn.relations.ChildrenCount > 0);
Log.Message("Creating pawn with lact" + pawn.Name);
}
}
}
}
}

View file

@ -1,50 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using rjw;
using Milk;
using UnityEngine;
namespace CRIALactation
{
/** //doesn't work because inheritance problems with rimworld
public class Precept_Lactation : Precept
{
public override void Notify_MemberSpawned(Pawn pawn)
{
Log.Message("spawning pawn with lact");
if (!pawn.IsColonistPlayerControlled && !LactationUtility.IsLactating(pawn))
{
LactationUtility.StartLactating(pawn, pawn.relations.ChildrenCount > 0);
}
//spawned into map
base.Notify_MemberSpawned(pawn);
}
public override void Notify_MemberGenerated(Pawn pawn)
{
Log.Message("Creating pawn with lact");
//first created
if(pawn.IsColonistPlayerControlled && LactationUtility.HasMilkableBreasts(pawn))
{
if (!LactationUtility.IsLactating(pawn))
{
LactationUtility.StartLactating(pawn, pawn.relations.ChildrenCount > 0);
Log.Message("Creating pawn with lact" + pawn.Name);
}
}
base.Notify_MemberGenerated(pawn);
}
}
**/
}

View file

@ -16,12 +16,12 @@ namespace CRIALactation
{
public override IEnumerable<Thing> PotentialWorkThingsGlobal(Pawn pawn)
{
return pawn.Map.mapPawns.SpawnedPawnsInFaction(pawn.Faction);
return pawn.Map.mapPawns.AllPawnsSpawned;
}
public override bool ShouldSkip(Pawn pawn, bool forced = false)
{
List<Pawn> list = pawn.Map.mapPawns.SpawnedPawnsInFaction(pawn.Faction);
List<Pawn> list = pawn.Map.mapPawns.AllPawnsSpawned;
for(int i = 0; i < list.Count; i++)
{
if(LactationUtility.isMassageable(list[i]))