EBSG Body - KonradHeinser/EBSGFramework GitHub Wiki
Due to how a pawn's graphics are handled, they usually don't update properly with age unless the player saves/reloads to force the game to update. Most gene classes from this framework will automatically refresh the graphic, with the easiest one to use being Hediff Adder. This will check once per in-game hour if the gene has the extension, and if it does it will force the game to redraw the pawn's body:
<geneClass>EBSGFramework.HediffAdder</geneClass>
The EBSGFramework.EBSGBodyExtension allows you to replace the body and head of pawns when it's attached to a gene. This extension can handle both desiccated body/head replacement, and a body/head visual change that is based on the age of the pawn. The desiccated replacement does not rely on ageGraphics existing, so if you use the vanilla head/body type replacement, you can still use the desiccated replacement stuff.
Everything goes inside this extension:
<modExtensions>
<li Class="EBSGFramework.EBSGBodyExtension">
</li>
</modExtensions>
Unlike most stuff in this wiki, there isn't much explanation needed for most of the individual options. The related texture will be replaced by whatever multi-texture the code finds at the end of the path given. The ones without body types attached to them are defaults that get used when none of the other filled in types work for the pawn, or if there aren't other parts. The only exception to this are children graphics, which will only check the child graphic:
- referenceGender : Default (False) : When set to true, male and female head/body will check for gender instead of body type. Children don't check this, as their male/female graphics are always based on gender
- desChildHead
- desFemaleChildHead
- desMaleChildHead
- desHead
- desMaleHead
- desFemaleHead
- desThinHead
- desHulkHead
- desFatHead
- desChild
- desFemaleChild
- desMaleChild
- desMale
- desFemale
- desThin
- desHulk
- desFat
- desBody
- ageGraphics : A special list of items for replacing non-desiccated bodies/heads based on age
- ageRange : Default (0~9999) : The range of ages that this graphic applies for. The end year is exclusive, so if you set it to 0~25, then a pawn that has turned 25 will no longer qualify
- referenceGender : Default (False) : When set to true, male and female head/body will check for gender instead of body type. Children don't check this, as their male/female graphics are always based on gender
- childHead
- femaleChildHead
- maleChildHead
- maleHead
- femaleHead
- thinHead
- hulkHead
- fatHead
- head
- child
- femaleChild
- maleChild
- male
- female
- thin
- hulk
- fat
- body
This example replaces the head of the pawn based on the age of the pawn, and when they die it will use the gaunt head as a base (in reality this should use special graphics, not the standard head graphics
<GeneDef>
<defName>Jaw_ThickeningJaw</defName>
<label>thickening jaw</label>
<description>As carriers of this gene age, a cartilage forms at the jaw that makes it appear much thicker than the bone.</description>
<iconPath>UI/Icons/Genes/Gene_JawBaseline</iconPath>
<displayCategory>Cosmetic</displayCategory>
<displayOrderInCategory>89</displayOrderInCategory>
<geneClass>EBSGFramework.HediffAdder</geneClass> <!--This class is required for automatically refreshing the pawn's appearance as their age changes-->
<exclusionTags>
<li>Jaw</li>
</exclusionTags>
<modExtensions>
<li Class="EBSGFramework.EBSGBodyExtension">
<desHead>Things/Pawn/Humanlike/Heads/Genes/None_Gaunt_Average</desHead>
<ageGraphics>
<li>
<ageRange>0~25</ageRange>
<head>Things/Pawn/Humanlike/Heads/Genes/None_Gaunt_Average</head>
</li>
<li>
<ageRange>40~9999</ageRange>
<head>Things/Pawn/Humanlike/Heads/Male/Male_HeavyJaw_Normal</head> <!--Any pawn that doesn't have the standard female body will use this-->
<femaleHead>Things/Pawn/Humanlike/Heads/Female/Female_HeavyJaw_Normal</femaleHead>
<!--If referenceGender is set to true, the female heavy jaw is applied to all females, regardless of body type-->
</li>
</ageGraphics>
</li>
</modExtensions>
</GeneDef>
To use the age based stuff for an attachment, you can use the EBSGFramework.PawnRenderNode_EBSGAttachmentHead nodeClass. This requires the li Class to be EBSGFramework.PawnRenderNodeProperties_EBSG, and has all the normal stuff available to head attachments plus most of the same stuff you saw in the extension:
<renderNodeProperties>
<li Class="EBSGFramework.PawnRenderNodeProperties_EBSG">
<nodeClass>EBSGFramework.PawnRenderNode_EBSGAttachmentHead</nodeClass>
<workerClass>PawnRenderNodeWorker_FlipWhenCrawling</workerClass>
</li>
</renderNodeProperties>
The options available in the li. Same as before, these point to the multi-graphic that you want to use for that particular body type, and graphic acts as a default if no other option is available:
- referenceGender : Default (False) : When set to true, male and female head/body will check for gender instead of body type. Children don't check this, as their male/female graphics are always based on gender
- hiddenByLayers : A list of ApparelLayerDefs that result in the attachment being hidden. If this is the only thing filled out, then vanilla render node stuff will take over if the apparel layer is not filled
- relatedBodyPartGroups : List of BodyPartGroupDefs that the apparel must be in to count. If left empty, then only the layer matters
- apparelExceptions : List of ThingDefs that don't hide the attachment
- desChild
- desFemaleChild
- desMaleChild
- desMale
- desFemale
- desThin
- desHulk
- desFat
- desGraphic
- ageGraphics : A special list of items for replacing non-desiccated bodies/heads based on age
- ageRange : Default (0~9999) : The range of ages that this graphic applies for. The end year is exclusive, so if you set it to 0~25, then a pawn that has turned 25 will no longer qualify
- referenceGender : Default (False) : When set to true, male and female head/body will check for gender instead of body type. Children don't check this, as their male/female graphics are always based on gender
- child
- femaleChild
- maleChild
- male
- female
- thin
- hulk
- fat
- graphic
If you are having issues with making the graphics update automatically as the pawn ages, try adding the Hediff Adder gene class and adding an empty version of the body extension:
<geneClass>EBSGFramework.HediffAdder</geneClass>
<modExtensions>
<li Class="EBSGFramework.EBSGBodyExtension" />
</modExtensions>
This example causes pawns to have ears on their head that change based on age
<GeneDef>
<defName>Ears_ChangingEars</defName>
<label>changing ears</label>
<description>As carriers of this gene age, their ears gradually change form.</description>
<iconPath>UI/Icons/Genes/Gene_EarFloppy</iconPath>
<displayCategory>Cosmetic</displayCategory>
<displayOrderInCategory>71</displayOrderInCategory>
<renderNodeProperties>
<li Class="EBSGFramework.PawnRenderNodeProperties_EBSG">
<nodeClass>EBSGFramework.PawnRenderNode_EBSGAttachmentHead</nodeClass>
<workerClass>PawnRenderNodeWorker_FlipWhenCrawling</workerClass>
<texPath>Things/Pawn/Humanlike/HeadAttachments/FloppyEars/FloppyEars</texPath>
<ageGraphics>
<li>
<ageRange>0~25</ageRange>
<graphic>Things/Pawn/Humanlike/HeadAttachments/PigEars/PigEars</graphic>
</li> <!--Between 25 and 30 years old the pawn has human ears-->
<li>
<ageRange>30~50</ageRange>
<female>Things/Pawn/Humanlike/HeadAttachments/PointedEars/PointedEars</female>
<graphic>Things/Pawn/Humanlike/HeadAttachments/FloppyEars/FloppyEars</graphic>
<referenceGender>True</referenceGender> <!--Makes the female graphic apply to all female pawns, regardless of body type-->
</li>
<li>
<ageRange>50~9999</ageRange>
<graphic>Things/Pawn/Humanlike/HeadAttachments/CatEars/CatEars</graphic>
</li>
</ageGraphics>
<colorType>Skin</colorType>
<parentTagDef>Head</parentTagDef>
<useSkinShader>true</useSkinShader>
<useRottenColor>true</useRottenColor>
<rotDrawMode>Fresh, Rotting</rotDrawMode>
<drawData>
<defaultData>
<layer>70</layer>
</defaultData>
</drawData>
</li>
</renderNodeProperties>
<exclusionTags>
<li>Ears</li>
</exclusionTags>
</GeneDef>
This should have all the same options as the head variant, the only difference is the worker and node class:
<li Class="EBSGFramework.PawnRenderNodeProperties_EBSG">
<workerClass>PawnRenderNodeWorker_AttachmentBody</workerClass>
<nodeClass>EBSGFramework.PawnRenderNode_EBSGAttachmentBody</nodeClass>
</li>