Traits Registration

Estimated reading time: less than 1 minute

Register custom traits via maplebirch.tool.patch.addTraits().

Access via maplebirch.tool.patch.addTraits().

Trait Interface

FieldTypeDescription
titlestringTrait title / category
namestringTrait identifier (required)
colourstringDisplay color
hasFunction | stringOwnership condition
textstringTrait description text

Example

const other = maplebirch.tool.patch;

other.addTraits({
  title: "General Traits",
  name: "brave",
  colour: "green",
  has: () => V.brave >= 1,
  text: "Character shows courage",
});

other.applyLocation();

Note

The framework resolves and deduplicates trait registration internally to avoid duplicate or incorrect overwrites. The maplebirch.tool.patch.addTraits API is unchanged.

boot.json

Traits can also be registered via the framework field in boot.json:

{
  "framework": {
    "traits": [
      {
        "title": "General Traits",
        "name": "brave",
        "colour": "green",
        "has": "V.brave >= 1",
        "text": "Character shows courage"
      }
    ]
  }
}

External .json, .yaml, or .yml files are also supported:

{
  "framework": {
    "traits": "data/traits.yaml"
  }
}