-
Notifications
You must be signed in to change notification settings - Fork 63
Blooming plants
This is a pretty complex system that we have used for Vanilla Plants Expanded - Flowers, it allows you to create plants that enter a blooming stage during a given period, affecting their beauty.
BloomingPlantExtension is as follows:
//Age, bloom and leafless beauty modifiers
public int AgeBeautyModifier = 0;
public int MaxAgeBeautyModifier = 0;
public float BloomBeautyModifier = 0;
public int LeaflessBeauty = 0;
public int WeededBeauty = -4;
//Bloom time variables
public Season BloomSeasonStart;
public int BloomDayStart = 1;
public Season BloomSeasonStop;
public int BloomDayEnd = 1;
public bool CanBloomAgain=true;
//Temperature variables
public int BloomTemperatureMin = 0;
public int DeadlyColdTemperature = 0;
public int DamageWhenBelowDeadlyTemp = 30;
//Bloom graphics
public string bloomGraphicPath;
public string alternateBloomGraphicPath="";
//Behaviours when blooming
public ThingDef itemProducedWhenBlooming = null;
public int longTicksPerItemProduced = 1;
public int itemProducedAmount = 1;
public ThingDef filthProducedWhenBlooming = null;
public int longTicksPerFilthProduced = 1;
public IntRange filthProducedAmount = IntRange.One;
public float filthProducedRadius = 1;
public HediffDef hediffWhenBlooming = null;
public float hediffRadius = 1;
public float hediffSeverity = 1;
public bool hediffOnlyAffectsColonists = true;This extension will only work for plants with the VEF.Plants.Plant_Blooming class, you need to put this in the <thingClass> tag of the plant's def.
Def Extensions are added to the <modExtensions> tag of the ThingDef of the plant you want to add them to.
If you aren't sure if the def ALREADY has an extension (for example, if you think another mod will add their own), always use XPATH (xml patching) to add an extension, as there is already a PatchOperationAddModExtension to ensure they don't collide.
For example, this is the XML base and one of the flowers in Vanilla Plants Expanded - Flowers
<ThingDef Name="VPEF_BloomingPlantBase" ParentName="PlantBase" Abstract="true">
<thingClass>VEF.Plants.Plant_Blooming</thingClass>
<statBases>
<MaxHitPoints>85</MaxHitPoints>
<Beauty>14</Beauty>
<BeautyOutdoors>14</BeautyOutdoors>
<Nutrition>0.05</Nutrition>
<Mass>1</Mass>
</statBases>
<graphicData>
<graphicClass>Graphic_Random</graphicClass>
</graphicData>
<pathCost>30</pathCost>
<fillPercent>0.2</fillPercent>
<altitudeLayer>Item</altitudeLayer>
<selectable>true</selectable>
<drawerType>MapMeshAndRealTime</drawerType>
<minifiedDef>VPEF_MinifiedFlower</minifiedDef> //This item is part of the Framework, and it handles minification
//of the flowers so they can be extracted and replanted
<ingestible>
<canAutoSelectAsFoodForCaravan>false</canAutoSelectAsFoodForCaravan>
</ingestible>
<plant>
<dieIfLeafless>false</dieIfLeafless>
<harvestTag>Standard</harvestTag>
<sowWork>750</sowWork>
<sowTags>
<li>Ground</li>
<li>Decorative</li>
</sowTags>
<growMinGlow>0.3</growMinGlow>
<topWindExposure>0.1</topWindExposure>
<growDays>1.5</growDays>
<lifespanDaysPerGrowDays>0</lifespanDaysPerGrowDays>
<visualSizeRange>0.3~1.05</visualSizeRange>
<wildOrder>1</wildOrder>
<purpose>Beauty</purpose>
</plant>
</ThingDef>
<ThingDef ParentName="VPEF_BloomingPlantBase">
<defName>VPEF_Plant_RedRoseBush</defName>
<label>red rose bush</label>
<description>A dense, woody shrub known for producing vibrant, classic roses. With its thick foliage and striking blooms, it serves as an excellent ornamental centerpiece for any garden.\n\nBlooms from 10th day of spring to 5th day of fall.</description>
<statBases>
<MaxHitPoints>150</MaxHitPoints>
<Beauty>16</Beauty>
<BeautyOutdoors>16</BeautyOutdoors>
<Nutrition>0.1</Nutrition>
</statBases>
<graphicData>
<texPath>Things/Flowers/RedRoseBush/RedRoseBush</texPath>
</graphicData>
<plant>
<leaflessGraphicPath>Things/Flowers/RedRoseBush/RedRoseBush_Leafless</leaflessGraphicPath>
<growDays>3.5</growDays>
<sowWork>1200</sowWork>
<harvestWork>400</harvestWork>
</plant>
<modExtensions>
<li Class="VEF.Plants.BloomingPlantExtension">
<AgeBeautyModifier>1</AgeBeautyModifier>
<MaxAgeBeautyModifier>16</MaxAgeBeautyModifier>
<bloomGraphicPath>Things/Flowers/RedRoseBush/RedRoseBush_Blooming</bloomGraphicPath>
<BloomSeasonStart>Spring</BloomSeasonStart>
<BloomDayStart>10</BloomDayStart>
<BloomSeasonStop>Fall</BloomSeasonStop>
<BloomDayEnd>5</BloomDayEnd>
<BloomTemperatureMin>12</BloomTemperatureMin>
<CanBloomAgain>true</CanBloomAgain>
<BloomBeautyModifier>2</BloomBeautyModifier>
<DeadlyColdTemperature>-15</DeadlyColdTemperature>
<LeaflessBeauty>-2</LeaflessBeauty>
</li>
</modExtensions>
</ThingDef>- Abilities
- Animal Behaviours
- Apparels
- Buildings
- Cooking
- Factions
- Genes
- Global
- Graphics
- Hediffs
- Maps
- Memes
- OptionalFeatures
- Pawns
- Planet
- Plants
- Storyteller
- Things
- Weapons
- Weathers
- PipeSystem basics
- Resource
- Resource storage
- Resource processor
- Resource to thing
- Resource to power
- Thing to resource
- Resource trader
- Refill building with pipes
- Pipe valve
- Advanced Resource Processor
- Update to KCSG 2.0
- Exporting buildings
- Customizing symbols
- Debug helpers options
- Custom faction settlement
- Custom structure and scenarios
- Custom structure in quests
- Custom structure in WorldObjects
- Biome based structures
- Spawning world object(s) at world generation
- Prevent settlement spawning for nomadic factions