Skip to content

Extended Traits [Hard Dependency]

TheInsanityGod edited this page Sep 23, 2026 · 1 revision

What are Extended Traits?

Essentially my own format for registering Traits/Abilities to the base game and other mods from JSON.

Currently it has integration with:

Defining Extended Traits

Extended Traits are defined through JSON in the assets/domain/extendedtraits folder.

image

Examples

ExtendedTraits file

[
  {
    "code": "engineer",
    "type": "positive",
    "Skill": "mechanics", //beware: InsanityLib will only create the abilities for you not the skill it's registered to.
    "IsSpecialization": true,
    "AppendToClasses": [ "clockmaker", "gearsmith" ],
    "TraitSystems": {
      //For XSkills it is always present (as it doubles as the specialization) for the rest it's only enabled when configured as such
      "Vanilla": "config://WearAndTear/Server/MainConfig/TraitRequirements",
      "DynamicTraits": "config://WearAndTear/Server/MainConfig/TraitRequirements"
    },
    "DynamicTraitCost": 4
  },
  {
    "code": "precise-measurements",
    "type": "positive",
    "Skill": "mechanics",
    "AppendToClasses": [ "clockmaker", "gearsmith" ],
    "DynamicTraitCost": 2,
    "Constraints": [
      {
        //Specialization requirement
        "Type": "Required",
        "TraitSystems": "XLib",
        "Skill": "mechanics",
        "TraitCode": "engineer"
      }
    ],
    "Enabled": "config://WearAndTear/Server/MainConfig/RoughDurabilityEstimate"
  },
  {
    "code": "reinforcer",
    "type": "positive",
    "Skill": "mechanics",
    "DynamicTraitCost": 4,
    "LevelForTrait": 5,
    "MaxLevel": 5,
    "Attributes": {
      "wearandtear:reinforcement-strength": { "Value": 0.1 }
    }
  }
]

Language keys

{
  // Traits
  "traittitle-engineer": "Engineer",
  "traitdesc-engineer": "Allows for mainting mechanical devices (if enabled in config). Trust me, I'm an engineer!",

  "traittitle-precise-measurements": "Precise Measurements",
  "traitdesc-precise-measurements": "Allows you to see exact percentage of durability remaining",

  "traittitle-reinforcer": "Reinforcer",

  // Stats
  "charattribute-reinforcement-strength": "{0:+0.##%;-0.##%;0%} reinforcement strength",
}

Note: This code comes from the WearAndTear Repository (full code can be seen there).

Clone this wiki locally