Spawn Baby - KonradHeinser/EBSGFramework GitHub Wiki
This thing comp causes the thing in question to spawn new baby humans periodically. This will check for fuel and growth where applicable, so only buildings with fuel and fully grown plants/pawns will actually create new humans. The basic comp looks like this:
<comps>
<li Class="EBSGFramework.CompProperties_SpawnBaby">
<completionTicks>2500</completionTicks>
<maxTotalSpawn>1</maxTotalSpawn>
<spawnPerCompletion>1</spawnPerCompletion>
</li>
</comps>
As an important note, this comp has limited methods for knowing who the parent(s) of the created children should be:
- Create Items Ability Comp : When the ability is cast, the caster will be treated as one of the parents, and if linkingHediff is being used and the caster has the hediff, the target of the hediff is the other parent
- Create Items Hediff Comp : Any time the hediff comp creates an item with this comp, the pawn with the hediff is treated as one of the parents, and if the linkingHediff is set and the pawn has the hediff, the target of the link is the other parent. Each individual item in that comp can point to separate HediffDefs, making it possible to have one spawn set contain different parents
These are the basic spawn setup options available:
- maxTotalSpawn : Default (1) : The total number of children that can be spawned. If set to -1, it will spawn indefinitely. If this is attached to a fuel using building, -1 is usually what you want unless you want the building to disappear after it makes a certain number of pawns
- spawnPerCompletion : Default (1~1) : How many pawns to try to spawn. This number will be limited by how many total spawns are left
- completionTicks : Default (600~600) : How many ticks there are between spawns. This should probably be set to a number higher than 10 seconds
- deleteOnFinalSpawn : Default (True) : When it runs out of the spawns listed in maxTotalSpawn, the thing is destroyed
- sendLetters : Default (True) : Send standard birth letters for each pawn made
- letterLabelNote : Default (born) : The label of the letter is the pawn's name followed by whatever is put here
- staticXenotype : XenotypeDef to always apply to the pawn
- xenotypeSource : Default (Hybrid) : If there is no static xenotype, then this will attempt to inherit genes from the related parent(s). The options are Hybrid, Mother, and Father. If staticXenotype is empty and this fails, the child will be born as a baseliner
- staticPawnKind : A static PawnKindDef to use. If not filled in, the game will attempt to use the mother's pawn kind def, followed by the fathers, followed by colonist if both of those fail
- developmentalStage : Default (Newborn) : The development stage new pawns should start with. Should only be added if you want to change it to Child or Adult
Some miscellaneous things that apply post-"birth":
- filthOnCompletion : ThingDef to create for every spawn. If left empty, nothing is made
- filthPerSpawn : Default (4~7) : The amount of filth to make for each baby made
- miscarriageThought : Default (True) : If the thing is destroyed before all children are created, this attempts to see if there are parents to apply a mood to
- motherMiscarriageThought : Default (Miscarried) : The ThoughtDef to try to apply to the mother if miscarriageThought is True and the object is destroyed
- fatherMiscarriageThought : Default (PartnerMiscarried) : The ThoughtDef to try to apply to the father if miscarriageThought is True and the object is destroyed
- bornThought : Default (True) : Apply a baby born thought to parents when the child is born
- motherBabyBornThought : Default (BabyBorn) : The ThoughtDef to try to apply to the mother if bornThought is True and a child is born
- fatherBabyBornThought : Default (BabyBorn) : The ThoughtDef to try to apply to the father if bornThought is True and a child is born
This example creates a special type of tree that starts creating a bunch of hussar babies shortly after it finishes growing completely, and a related ability that spawns said tree:
<ThingDef ParentName="DeciduousTreeBase">
<defName>EBSG_HussarTree</defName>
<label>hussar tree</label>
<description>Murder tree.</description>
<tickerType>Normal</tickerType>
<graphicData>
<texPath>Things/Plant/TreeOak</texPath>
<graphicClass>Graphic_Random</graphicClass>
<shadowData>
<volume>(0.2, 0.35, 0.13)</volume>
<offset>(-0.03,0,-0.44)</offset>
</shadowData>
</graphicData>
<statBases>
<Beauty>2</Beauty>
<BeautyOutdoors>2</BeautyOutdoors>
</statBases>
<plant>
<growDays>30</growDays>
<leaflessGraphicPath>Things/Plant/TreeOak_Leafless</leaflessGraphicPath>
<immatureGraphicPath>Things/Plant/TreeOak_Immature</immatureGraphicPath>
<harvestWork>1400</harvestWork>
<harvestTag />
<harvestYield>40</harvestYield>
<wildClusterWeight>0</wildClusterWeight>
</plant>
<comps>
<li Class="EBSGFramework.CompProperties_SpawnBaby">
<completionTicks>2500</completionTicks>
<maxTotalSpawn>10</maxTotalSpawn>
<spawnPerCompletion>1~3</spawnPerCompletion>
<staticXenotype>Hussar</staticXenotype>
</li>
</comps>
</ThingDef>
<AbilityDef>
<defName>EBSG_MakeHussarTree</defName>
<label>make hussar tree</label>
<description>There was a description here.</description>
<iconPath>UI/Abilities/Resurrect</iconPath>
<aiCanUse>False</aiCanUse>
<jobDef>CastAbilityOnThingWithoutWeaponInterruptible</jobDef>
<cooldownTicksRange>100</cooldownTicksRange>
<canUseAoeToGetTargets>False</canUseAoeToGetTargets>
<displayGizmoWhileUndrafted>True</displayGizmoWhileUndrafted>
<disableGizmoWhileUndrafted>False</disableGizmoWhileUndrafted>
<hostile>false</hostile>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<warmupTime>1</warmupTime>
<range>24.9</range>
<targetParams>
<canTargetPawns>False</canTargetPawns>
<canTargetBuildings>False</canTargetBuildings>
<canTargetLocations>True</canTargetLocations>
<canTargetPlants>False</canTargetPlants>
</targetParams>
</verbProperties>
<comps>
<li Class="EBSGFramework.CompProperties_AbilityCreateItems">
<thingPattern>
<li>
<thing>EBSG_HussarTree</thing>
<count>1</count>
</li>
</thingPattern>
</li>
</comps>
</AbilityDef>