Ludeon Forums

RimWorld => Mods => Help => Topic started by: Bodog999 on February 04, 2016, 03:59:39 PM

Title: Wild animals produce milk
Post by: Bodog999 on February 04, 2016, 03:59:39 PM
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?
Title: Re: Wild animals produce milk
Post by: Fluffy (l2032) on February 05, 2016, 02:07:59 AM
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.