You can see the code if you open your Rimworld folder, if you have it installed via Steam the folder path you want is something like this: "D:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\Core\Defs\Bodies\Bodies_Humanlike.xml". You should be able to open this in Notepad or Notepad++.
This file defines how the individual bodyparts are connected into the body. From this you should see that there is a <BodyDef> with a <defName> of Human. It has a <corePart> with a <def> of Torso to which all other bodyparts are ultimately attached. Anything that is attached to the torso is included within its <parts> node. The shoulders then have their own <parts> node containing the clavicle and arm, which has a <parts> node and so on. Using your example the basic structure looks like this:
Note: I have excluded a lot code just to show the basic structure, looking at the actual code shows that each element should have a coverage value assigned that determines how likely a bodypart is to hit (and the mass to deduct if that part is missing). A shoulder is 12% of the body, an arm is 77% of the shoulder (9.24% of the total body) and a hand is 14% of the arm (1.29% of the total body).
Bodyparts can also be assigned customLabels, groups and depth values.
It should also be noted that every bodypart has its own <BodyPartDef> defined in the various BodyParts files in the same folder. These define the hit points, and any relevant tags such as ManipulationLimbSegment or BreathingSource that the game uses to determine whether a pawn is capable of moving or even living.
This file defines how the individual bodyparts are connected into the body. From this you should see that there is a <BodyDef> with a <defName> of Human. It has a <corePart> with a <def> of Torso to which all other bodyparts are ultimately attached. Anything that is attached to the torso is included within its <parts> node. The shoulders then have their own <parts> node containing the clavicle and arm, which has a <parts> node and so on. Using your example the basic structure looks like this:
Code Select
<BodyDef>
<defName>Human</defName>
<label>human</label>
<corePart>
<def>Torso</def>
<parts>
<li>
<def>Shoulder</def>
<parts>
<li>
<def>Arm</def>
<parts>
<li>
<def>Hand</def>
<parts>
<li>
<def>Finger</def>
</li>
<li>
<def>Finger</def>
</li>
<li>
<def>Finger</def>
</li>
<li>
<def>Finger</def>
</li>
<li>
<def>Finger</def>
</li>
</parts>
</li>
</parts>
</li>
</parts>
</li>
</parts>
</corePart>
</BodyDef>
Note: I have excluded a lot code just to show the basic structure, looking at the actual code shows that each element should have a coverage value assigned that determines how likely a bodypart is to hit (and the mass to deduct if that part is missing). A shoulder is 12% of the body, an arm is 77% of the shoulder (9.24% of the total body) and a hand is 14% of the arm (1.29% of the total body).
Bodyparts can also be assigned customLabels, groups and depth values.
It should also be noted that every bodypart has its own <BodyPartDef> defined in the various BodyParts files in the same folder. These define the hit points, and any relevant tags such as ManipulationLimbSegment or BreathingSource that the game uses to determine whether a pawn is capable of moving or even living.