Animal Resources - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki

CompAnimalProduct is a comp class that is offered as alternative to base game's Milkable and Shearable, to allow animals to produce things that aren't milk or wool. It is customizable to produce a random item, as well as to sometimes produce additional items.

    //CompAnimalProduct builds upon both CompMilkable and CompShearable, with many more configuration options

    public int gatheringIntervalDays = 1;
    public int resourceAmount = 1;
    public ThingDef resourceDef = null;

    //customResourceString allows you to set a different string on the info panel

    public string customResourceString = "";

    //CompProperties_AnimalProduct allows an animal to produce random items

    public bool isRandom = false;
    public List<string> randomItems = null;
   
    //CompProperties_AnimalProduct allows an animal to produce the normal item, and a 
    few additional items, chosen from a list

    public bool hasAditional = false;
    public int additionalItemsProb = 1;
    public int additionalItemsNumber = 1;
    public List<string> additionalItems = null;

How do I use this code?

It is a comp class, so you just add it in XML in the <comps> tag. For example, this allows a Bouldermit to produce random stone chunks

<comps>
	<li Class="AnimalBehaviours.CompProperties_AnimalProduct">
		<resourceDef>AA_RandomStones</resourceDef>
		<gatheringIntervalDays>1</gatheringIntervalDays>
		<resourceAmount>1</resourceAmount>
		<customResourceString>StoneChunkDesc</customResourceString>
		<isRandom>true</isRandom>
		<randomItems>
			<li>ChunkSandstone</li>
			<li>ChunkGranite</li>
			<li>ChunkLimestone</li>
			<li>ChunkSlate</li>
			<li>ChunkMarble</li>
		</randomItems>

	</li>
			

</comps>
⚠️ **GitHub.com Fallback** ⚠️