Skip to content

Dig When Hungry

juanosarg edited this page Jul 31, 2021 · 8 revisions

CompDigWhenHungry allows an animal to dig in the ground for a given resource, but only when hungry. A list of accepted terrain defNames can be specified

     //Similar to CompProperties_DigPeriodically, but only when hungry

    public string customThingToDig = "";
    public int customAmountToDig = 1;

    //A list of extra things that can be dug up
    public List<string> customThingsToDig = null;
    //A corresponding list of amounts of extra things that can be dug up, will default to customAmountToDig if not set.
    public List<int> customAmountsToDig = null;

    //timeToDig has a misleading name. It is a minimum counter. The user will not dig if less than timeToDig ticks have passed.
    //This is done to avoid an animal digging again if it's still hungry.
    public int timeToDig = 40000;
    //A list of acceptable terrains can be specified
    public List<string> acceptedTerrains = null;
    //Should items be spawned forbidden?
    public bool spawnForbidden = false;
    //Should the animal dig for items even if it's not hungry, every timeToDigForced ticks?
    public bool digAnywayEveryXTicks = true;
    public int timeToDigForced = 120000;
    //Frostmites dig for dead wildmen
    public bool isFrostmite = false;
    //Dig only if during growing season
    public bool digOnlyOnGrowingSeason = false;
    public int minTemperature = 0;
    public int maxTemperature = 58;

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 Penguins in Vanilla Animals Expanded - Ice Sheet to dig for fish:

<comps>
	<li Class="AnimalBehaviours.CompProperties_DigWhenHungry">
		<customThingToDig>AEXP_RawFish</customThingToDig>
		<customAmountToDig>10</customAmountToDig>
	</li>
</comps>

VFE Core

General Comp classes

General DefModExtensions

Item Processor

PipeSystem

Custom Structure Generation

Multi Verb Combat Framework - MVCF

Animal Behaviours

Genes

Apparel

Cuisine

Furniture

Plants

Deprecated

Clone this wiki locally