Biome Genes - KonradHeinser/EBSGFramework GitHub Wiki
Biome Genes allow you to make genes that cause carriers to have preferences for very specific biomes. These preferences can be shown through both through hediffs and by changing the needs of pawns. First, the gene itself requires the following things to start:
<geneClass>EBSGFramework.BiomeGene</geneClass>
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
</li>
</modExtensions>
Most of the customizing tags within this extension use lists to allow for multiple effects more easily. I'm giving it in list form as there isn't really a practical way for me to demonstrate every single one individually, but the example at the bottom shows how you can use a lot of these. The following list includes all tags available for this class, separated by category:
- Need Offsets - This isn't for the main extension area, but the individual need offsets. For an example of what I mean, scroll to the bottom where a gene changes the amount of recreation the pawn has, or to Offset Needs Ability where you can find a similar effect in ability form. All 5 needOffsetsPerHour have these options:
- need : If not included, then the code will pick a random need that it hasn't messed with yet
- offset : The base amount the need is changed by. A value of 1 would max out the need after 1 hour
- offsetFactorStat : A multiplier on the offset
-
Amazing Biomes - If the pawn's current map, or caravan tile, has one of these biomes, the related hediffs and need offsets are applied
- amazingBiomes : List of BiomeDefs
- hediffsWhileInAmazingBiome : List of HediffDefs
- needOffsetsPerHourInAmazingBiome : List of need offsets
-
Great Biomes - If the pawn's current map, or caravan tile, has one of these biomes, the related hediffs and need offsets are applied
- greatBiomes : List of BiomeDefs
- hediffsWhileInGreatBiome : List of HediffDefs
- needOffsetsPerHourInGreatBiome : List of need offsets
-
Good Biomes - If the pawn's current map, or caravan tile, has one of these biomes, the related hediffs and need offsets are applied
- goodBiomes : List of BiomeDefs
- hediffsWhileInGoodBiome : List of HediffDefs
- needOffsetsPerHourInGoodBiome : List of need offsets
-
Bad Biomes - If the pawn's current map, or caravan tile, has one of these biomes, the related hediffs and need offsets are applied
- badBiomes : List of BiomeDefs
- hediffsWhileInBadBiome : List of HediffDefs
- needOffsetsPerHourInBadBiome : List of need offsets
-
Terrible Biomes - If the pawn's current map, or caravan tile, has one of these biomes, the related hediffs and need offsets are applied
- terribleBiomes : List of BiomeDefs
- hediffsWhileInTerribleBiome : List of HediffDefs
- needOffsetsPerHourInTerribleBiome : List of need offsets
-
Abysmal Biomes - If the pawn's current map, or caravan tile, has one of these biomes, the related hediffs and need offsets are applied
- abysmalBiomes : List of BiomeDefs
- hediffsWhileInAbysmalBiome : List of HediffDefs
- needOffsetsPerHourInAbysmalBiome : List of need offsets
-
biomeOverridesWater : Default (False) : This belongs between sections as, if this is true, then the below stuff won't be checked unless the pawn is in a neutral biome (any BiomeDef that isn't listed)
-
Raining - Raining can have up to two separate effects, depending on if you leave the satisfy water option enabled. The first is effects that always happen when it is raining on the map the pawn is currently on, and the second is to activate the in water effects mentioned in the next section
- waterSatisfiedByRain : Default (True) : Set this to false if you only want the water condition to be satisfied by being in/near bodies of water
- minimumRainAmount : Default (0) : Check the weather to see if the rain rate is any value above, but not including this number. As far as I know, all vanilla weather's use 1, so this probably shouldn't be changed
- hediffsWhileRaining : List of HediffDefs
- needOffsetsPerHourWhileRaining : List of need offsets
-
In Water - This section defines what classifies as "In Water" to the pawn, along with what effects to cause while in water
- maxWaterDistance : Default (0) : While 0, the pawn only counts as in water if they are literally in water (including rain enabled)
- waterTilesNeeded : Default (1) : How many tiles of water need to be found to satisfy the conditions, if this is above 1, then you'll need to increase the water distance
- hediffsWhileInWater : List of HediffDefs
- needOffsetsPerHourInWater : List of need offsets
-
Not in Water - This section is used whenever the above section is not
- hediffsWhileOutOfWater : List of HediffDefs
- needOffsetsPerHourNotInWater : List of need offsets
If the carrier is intended to enjoy water, you can include the gene on the relax in water job list with the below patch operation, simply switching out InsertGeneDefNameHere with your gene's defName. If you have multiple genes to add to the list, you can add more li's, and should add some new lines and proper indentation:
<Operation Class="PatchOperationAdd">
<xpath>Defs/JoyGiverDef[defName="EBSG_RelaxInWater"]/modExtensions/li[@Class="EBSGFramework.EBSGExtension"]/relatedGenes</xpath>
<value><li>InsertGeneDefNameHere</li></value>
</Operation>
Example of a gene which makes the carrier prefer wet climates and being around water. The hediffs I made for this didn't actually do anything, just had labels similar to their defName:
<GeneDef>
<defName>AquaticGene</defName>
<label>aquatic preference</label>
<description>Carriers of this gene prefer water biomes along with being around water</description>
<iconPath>UI/Icons/Genes/Gene_HairColor</iconPath> <!--Using a generic icon that's I know will be there-->
<displayCategory>Miscellaneous</displayCategory>
<geneClass>EBSGFramework.BiomeGene</geneClass>
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<goodBiomes>
<li>Ocean</li>
<li>Lake</li>
<li>TropicalSwamp</li>
<li>TropicalRainforest</li>
<li>TemperateSwamp</li>
<li>ColdBog</li>
</goodBiomes>
<badBiomes>
<li>AridShrubland</li>
<li>Desert</li>
<li>ExtremeDesert</li>
</badBiomes>
<maxWaterDistance>10</maxWaterDistance>
<hediffsWhileInWater>
<li>AquaticGene_InWater</li>
</hediffsWhileInWater>
<hediffsWhileOutOfWater>
<li>AquaticGene_NotInWater</li>
</hediffsWhileOutOfWater>
<hediffsWhileInGoodBiome>
<li>AquaticGene_InGoodBiome</li>
</hediffsWhileInGoodBiome>
<hediffsWhileInBadBiome>
<li>AquaticGene_InBadBiome</li>
</hediffsWhileInBadBiome>
<hediffsWhileRaining>
<li>AquaticGene_Raining</li>
</hediffsWhileRaining>
<needOffsetsPerHourInWater>
<li>
<need>Joy</need>
<offset>0.1</offset>
</li>
</needOffsetsPerHourInWater>
<needOffsetsPerHourNotInWater>
<li>
<need>Joy</need>
<offset>-0.1</offset>
</li>
</needOffsetsPerHourNotInWater>
</li>
</modExtensions>
</GeneDef>
<Operation Class="PatchOperationAdd">
<xpath>Defs/JoyGiverDef[defName="EBSG_RelaxInWater"]/modExtensions/li[@Class="EBSGFramework.EBSGExtension"]/relatedGenes</xpath>
<value><li>AquaticGene</li></value>
</Operation>