Dynamic Modification to Body Defs

Started by DarkSlayerEX, January 31, 2016, 10:29:05 AM

Previous topic - Next topic

DarkSlayerEX

Iapologise in advance if this doesn't make much sense at first. I'd be happy to give further detail if asked.

I was looking into trying to make a more varied race, only to learn that the race's body definition is defined to the point where each body part's label would be what displays in game.

IE:
        <li>
          <def>Rib</def>
          <coverage>0.001</coverage>
          <depth>Inside</depth>
          <groups>
            <li>Torso</li>
          </groups>
        </li>


Multiple instances of this appear to use the same  BodyPart Def. Should you however decide to label each rib, you are forced to make a new BodyPart def for each new label.

What I propose, is to make a change, sort of like so.

        <li>
          <def>FirstRib</def>
          <label>First Rib</label>
          <BodyPartType>Rib</BodyPartType>
          <coverage>0.001</coverage>
          <depth>Inside</depth>
          <groups>
            <li>Torso</li>
          </groups>
        </li>


This should allow your races to have more than one heart for example, while still being able to use a single heart Def:

        <li>
          <def>PrimaryHeart</def>
          <label>Primary Heart</label>
          <BodyPartType>Heart</BodyPartType>
          <coverage>0.001</coverage>
          <depth>Inside</depth>
          <groups>
            <li>Torso</li>
          </groups>
        </li>
        <li>
          <def>SecondaryHeart</def>
          <label>Secondary Heart</label>
          <BodyPartType>Heart</BodyPartType>
          <coverage>0.001</coverage>
          <depth>Inside</depth>
          <groups>
            <li>Torso</li>
          </groups>
        </li>


I feel this can greatly expand the ability to make more variety, without having to tediously add new body part defs just to have them show up with different labels in game.

We could also possibly expand the Bodypart Def setup itself, to allow flags like <Race> to show which race it belongs to, and as well as <CompatibleWith> tab, for if you are using a custom racial Organ set (AlienX heart - Compatible with Humans)

This should then allow Harvested organs/bodyparts to be innately configured to allow installing any organ/bodypart with an appropriate set of flags, without further coding needed.

Example:

  <BodyPartDef>
    <defName>HumanHeart</defName>
    <BodyPartType>Heart</BodyPartType>
    <label>Heart</label>
    <hitPoints>20</hitPoints>
    <Race>Human</Race>
    <CompatibleWith>
        <li>Norbal</li>
        <li>Pigman</li>
    </CompatibleWith>
    <oldInjuryBaseChance>0.08</oldInjuryBaseChance>
    <bleedingRateMultiplier>1.5</bleedingRateMultiplier>
    <skinCovered>false</skinCovered>
    <activities>
      <li>BloodPumping</li>
    </activities>
    <spawnThingOnRemoved>HumanHeart</spawnThingOnRemoved>
    <dontSuggestAmputation>true</dontSuggestAmputation>
  </BodyPartDef>


and as for a race definition:

  <BodyDef>
    <defName>Pigman</defName>
    <label>Weascon</label>
..
..
        <li>
          <def>Heart</def>
          <bodyPart>Heart</bodyPart>
          <coverage>0.015</coverage>

          <depth>Inside</depth>
          <groups>
            <li>Torso</li>
          </groups>
        </li>
..


With compatibility similar to this, we should be able to make races with multiple sets of arms, legs, lungs, hearts or anything like that much more simply.