Modding:Bodies

From Caves of Qud Wiki
Jump to navigation Jump to search
This page is about modding. See the modding overview for an abstract on modding.
This page is about modding. See the modding overview for an abstract on modding.
This article is a stub. You can help Caves of Qud Wiki by expanding it.
This article is a stub. You can help Caves of Qud Wiki by expanding it.

Bodies are how the game conceptually organizes creatures, primarily for purposes of equipment slots. Through modding, the body of any creature is completely customizable.

Bodies.xml

The data file for body information is Bodies.xml. It's organized into three main sections:

  • bodyparttypes (or types for short), the core kinds of body parts;
  • bodyparttypevariants (or variants for short), body part sub-types that are more or less interchangeable with other parts of the same main type;
  • and anatomies, which are actual structures of body parts. These are assigned to objects in ObjectBlueprints.xml.

Caves of Qud provides support for defining custom body part types, variants, and anatomies. To have a creature use a specific anatomy, you set the Body part in that creature's object blueprint definition. For example:

<part Name="Body" Anatomy="Spider" />

This tells the game that you want to use the Spider anatomy for a given creature.

Body part types

Body part types are defined under the <bodypartytypes> tag in Bodies.xml. For example, the Head part type is defined as follows:

<bodies>
  <bodyparttypes>
    <!-- ... -->
    <bodyparttype Type="Head" LimbBlueprintProperty="SeveredHeadBlueprint" LimbBlueprintDefault="GenericHead" Mortal="true" Appendage="true" UsuallyOn="Body" Branching="Lateral,Longitudinal,Vertical,Stratal" ChimeraWeight="3" />
    <!-- ... -->
  </bodyparttypes>

  <!-- Variants and anatomies are defined below -->
  <!-- ... -->
</bodies>

A body part type defines a abstracted category of possible features in a creature's anatomy. The Hand body part type encompasses a human hand, a plant's tendril, and a robotic manipulator; the Face body part type encompasses a human's face, a fungus's sensory frills, and an ooze's sensory ganglion. In practice, the variant of a body part type affects what kinds of items can be equipped into its resulting inventory slot.

You can mod in your own body part variants by defining your own Bodies.xml. Here are the attributes supported by the <bodyparttype> tag:

Attribute Description
Abstract Marks a body part type as abstract. This is used to provide equipment slots that don't actually map to physical limbs, e.g. floating nearby slots, thrown weapon, and missile weapon slots.
Appendage Marks a limb type as an appendage, allowing it to be severed[1] (note that abstract body part types are non-severable by default).
Branching
Category
ChimeraWeight Weight affecting the probability that the limb type is selected when generating a new limb via the Chimera morphotype.
Contact
DefaultBehavior
Description Overrides the name of the body slot as it appears in the inventory menu.
DescriptionPrefix Adds a prefix to the name of the body slot as it appears in the inventory menu. For example, the Back slot has a DescriptionPrefix of Worn on, so the slot appears as "worn on back" in the inventory screen.
Extrinsic Marks a body part type as being extrinsic to a creature's body; for example, the robo-hands and robo-arms granted by helping hands. This has a few minor effects; for example, it ensures that the body part doesn't get copied when creating a copy of your anatomy. It also prevents that body part from being set as a primary limb and prevents it from dropping an object when severed.
ImpliedBy
ImpliedPer
Integral
LimbBlueprintProperty The tag to look for to determine the object blueprint that should be used when this limb is severed. For example, the Hand part type specifies the SeveredHandBlueprint limb blueprint. This is used by robots to define the default hand type they should drop:
<objects>
  <!-- ... -->
  <object Name="Robot" Inherits="Creature">
    <!-- ... -->
    <tag Name="SeveredHandBlueprint" Value="RobotHand" />
    <!-- ... -->
  </object>
  <!-- ... -->
</objects>
LimbBlueprintDefault The default blueprint that should be used for a severed version of the limb when one isn't explicitly specified.
Mobility Marks the limb as providing mobility, and gives a weight to how much that limb contributes to the creature's overall mobility. In the case where the limb is severed, its mobility score influences the creature's resultant loss in movement speed. For example, a limb with Mobility="10" contributes ten times as much to a creature's overall mobility as a limb with Mobility="1".
Mortal Marks a body part as mortal, which has implications for skills like Amputate Limb and Decapitate. Heads are the most common example of mortal body party.
Name The name of the part type. Should be unique.
NoArmorAveraging Disable averaging of AV across body parts of this type.
Plural
UsuallyOn

Body part type variants

In addition to specifying broad categories of body part types, you can also specify variants. Outside of any properties that you explicitly define for a variant, these are functionally equivalent to their original type.

Here is how Bodies.xml defines the Tentacle part type:

<bodies>
  <!-- ... -->
  <bodyparttypevariants>
    <!-- ... -->
    <bodyparttypevariant VariantOf="Hand" Type="Tentacle" DefaultBehavior="SoftManipulator" Mobility="1" UsuallyOn="Body" />
    <!-- ... -->
  </bodyparttypevariants>
  <!-- ... -->
</bodies>

VariantOf specifies the original part type that this variant belongs to; Type is the unique name of the variant. A type variant can define any of the properties that would normally be defined by a bodyparttype.

Anatomies

An anatomy is a collection of body parts. An anatomy is defined in XML as a nested collection of <part> tags. As an example, here is the default anatomy of a bird:

<bodies>
  <!-- ... -->

  <anatomies>
    <!-- ... -->

    <anatomy Name="Bird">
      <part Type="Head">
        <part Type="Face" DefaultBehavior="Beak" />
      </part>
      <part Type="Back" />
      <part Type="Foot" Laterality="Right" SupportsDependent="Feet" />
      <part Type="Foot" Laterality="Left" SupportsDependent="Feet" />
      <part Type="Missile Weapon" Laterality="Right" />
      <part Type="Missile Weapon" Laterality="Left" />
      <part Type="Feet" DependsOn="Feet" />
      <part Type="Tail" />
    </anatomy>

    <!-- ... -->
  </anatomies>
</bodies>

The anatomy tag supports the following attributes:

Attribute Description
BodyCategory
BodyMobility Weighs the creature's body slot when computing the total mobility of the creature. This is used by some creatures, such as creatures with the Snake or Slug anatomies, that don't have any foot slots by default.
BodyType The type of Body (the body part type) that should be used for the creature. You can use this to replace the default Body slot for a creature with a custom type variant.
Category
FloatingNearby The type of FloatingNearby body part type that should be used for the creature. This allows you to use a type variant for floating nearby slots.
ThrownWeapon The type of Thrown Weapon body part type that should be used for the creature. This allows you to use a type variant for thrown weapon slots. For example, the BipedalRobot anatomy adds a thrown weapon slot using a Middle Hardpoint:
<anatomy Name="BipedalRobot" Category="Mechanical" ThrownWeapon="Middle Hardpoint">
  <part Type="Control Unit">
    <part Type="Sensor Array" />
  </part>
  <part Type="Chassis" />
  <part Type="Hardpoint" Laterality="Right" />
  <part Type="Hardpoint" Laterality="Left" />
  <part Type="Feet" />
</anatomy>

Meanwhile, the <part> tag in Bodies.xml supports:

Attribute Description
Abstract Marks the body part as abstract.
Category Alter the category of the limb.
Contact
DefaultBehavior
DependsOn
Extrinsic
IgnorePosition
Integral Alter the integrality of the limb.
Laterality Used to set the position / orientation of the limb. Laterality allows players to distinguish limbs of the same type from one another. For example, humanoids have a left and right arm; fish have a left and right fin; frogs have left fore, right fore, left hind, and right hind feet.
Mass
Mobility Alter the mobility contribution of the limb.
Mortal Alter the mortality of the limb.
Plural
RequiresLaterality
RequiresType
SupportsDependent
Type The name of the body part type or type variant that should be added (for example: Hand, Smooth Face, etc.)

References

  1. XRL.World.Anatomy.BodyPart, method IsSeverable