Wild animals produce milk

Started by Bodog999, February 04, 2016, 03:59:39 PM

Previous topic - Next topic

Bodog999

So after going trough all the files of the core game I'm still unable to get wild animals to produce milk. So far I know that the animal has to be tamed in order to start producing milk. I would like to have wild animals to produce milk to test some stuff. Does anyone know if its possible?

Fluffy (l2032)

You problem is that CompHasGatherableBodyResource, from which both milking and sheering derive, has a default implementation of only being active when a pawn has a faction (wild animals have null faction).
protected virtual bool Active
{
get
{
return this.parent.Faction != null;
}
}

Both milkable and shearable check this base implementation first before they proceed;
get
{
if (!base.Active)
{
return false;
}
Pawn pawn = this.parent as Pawn;
return (!this.props.milkFemaleOnly || pawn == null || pawn.gender == Gender.Female) && (pawn == null || pawn.ageTracker.CurLifeStage.milkable);
}


So, what can you do? Custom dll for new CompMilkable, inherit compmilkable and override the Active property to no longer consider the base implementation.