Skip to content

Graphic by Terrain

juanosarg edited this page May 20, 2024 · 4 revisions

CompGraphicByTerrain makes an animal change graphic when it steps on some terrains

    //CompGraphicByTerrain changes a creature's graphic depending on the terrain it is positioned at


    public int changeGraphicsInterval = 240;

    //These three lists need to be the same length, as they are accessed by their indexes

    public List<string> terrains = null;
    public List<string> suffix = null;              
    public List<string> hediffToApply = null;

    //This will ignore the terrain and just check if "IsWater"

    public bool waterOverride = false;
    public string waterSuffix = "_Winter";
    public string waterHediffToApply = "";
    public int waterSeasonalItemsIndex = 0;

    //This will ignore the terrain and just check if temperature is less than temperatureThreshold

    public bool lowTemperatureOverride = false;
    public int temperatureThreshold = -10;
    public string lowTemperatureSuffix = "_Winter";
    public string lowTemperatureHediffToApply = "";
    public int lowTemperatureSeasonalItemsIndex = 0;

    //This will ignore the terrain and just check if there is snow on it

    public bool snowOverride = false;
    public string snowySuffix = "_Winter";
    public string snowyHediffToApply = "";
    public int snowySeasonalItemsIndex = 0;

    //This goes in tandem with CompAnimalProduct to allow different animal products depending on terrain

    public bool provideSeasonalItems = false;
    public List<int> seasonalItemsIndexes = 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 the Chameleon Yak in Alpha Animals to change its pelt

<comps>
	<li Class="AnimalBehaviours.CompProperties_GraphicByTerrain">
		<changeGraphicsInterval>240</changeGraphicsInterval>
		
		<terrains>
			<li>Ice</li>
			<li>MossyTerrain</li>
			<li>MarshyTerrain</li>
			<li>SoilRich</li>
			<li>Sand</li>
			<li>SoftSand</li>					
		</terrains>
		<suffix>
			<li>_Winter</li>
			<li>_Jungle</li>
			<li>_Jungle</li>
			<li>_Jungle</li>
			<li>_Desert</li>
			<li>_Desert</li>					
		</suffix>
		<hediffToApply>
			<li>AA_WinterPelt</li>
			<li>AA_JunglePelt</li>
			<li>AA_JunglePelt</li>
			<li>AA_JunglePelt</li>
			<li>AA_DesertPelt</li>
			<li>AA_DesertPelt</li>
		</hediffToApply>
			
		<waterOverride>true</waterOverride>
		<waterSuffix>_Jungle</waterSuffix>
		<waterHediffToApply>AA_JunglePelt</waterHediffToApply>
		<waterSeasonalItemsIndex>2</waterSeasonalItemsIndex>
		
		<lowTemperatureOverride>true</lowTemperatureOverride>
		<temperatureThreshold>-10</temperatureThreshold>
		<lowTemperatureSuffix>_Winter</lowTemperatureSuffix>
		<lowTemperatureHediffToApply>AA_WinterPelt</lowTemperatureHediffToApply>
		<lowTemperatureSeasonalItemsIndex>1</lowTemperatureSeasonalItemsIndex>
				
		<snowOverride>true</snowOverride>
		<snowySuffix>_Winter</snowySuffix>
		<snowyHediffToApply>AA_WinterPelt</snowyHediffToApply>
		<snowySeasonalItemsIndex>1</snowySeasonalItemsIndex>
				
		<provideSeasonalItems>true</provideSeasonalItems>
		<seasonalItemsIndexes>
			<li>1</li>
			<li>2</li>
			<li>2</li>
			<li>2</li>
			<li>3</li>
			<li>3</li>					
		</seasonalItemsIndexes>
	</li>
</comps>

You will also need to add a PawnRenderNode to the animal, AnimalBehaviours.PawnRenderNode_GraphicByTerrain

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