Skip to main content
forge-attributes owns a character’s stats. An attribute has a base value plus any number of modifiers from other systems (equipment, effects, buffs). The final value is computed at read time, so callers always see the live total.

Concepts

  • Definition. A stable attr:<name> with a label, default, min, and max. Ships a generic six-attribute set (STR/DEX/INT/CON/WIS/CHA).
  • Base value. The character’s own stat, persisted.
  • Modifier. A contribution from a source, keyed by source_id so it can be removed exactly. op is add (more ops may follow).
  • Resolution. final = base + sum(add modifiers), clamped to the definition’s range.

Exports

Modifier shape

Attribute modifiers use attribute_id when supplied through forge-effects definitions, but AddModifier itself takes attribute_id as its second argument and a modifier table whose field is source_id. Match the shapes above exactly.

Events

Modifiers are cleared automatically when a character deactivates; their owning system re-applies them on the next activation.

Configuration

The six default attributes live in editable shared/data/attributes.lua (ForgeAttributes.DefaultAttributes), gated by Config.ShipDefaults. Add or override by id via the data file or Config.Attributes.