Modding:Bodies

From Caves of Qud Wiki
Revision as of 06:24, 6 July 2024 by Kernelmethod (talk | contribs) (Add descriptions for more bodyparttype attributes)
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.

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.
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. This influences the loss in movement speed that occurs when that limb is severed.
Mortal Marks a body part as mortal, which has implications for skills like Amputate 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
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
Category
Contact
DefaultBehavior
DependsOn
Extrinsic
IgnorePosition
Integral
Laterality
Mass
Mobility
Mortal
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.)
  1. XRL.World.Anatomy.BodyPart, method IsSeverable