DataDungeon::TraitKey
Canonical trait keys. A key is the asset type followed by the values of
its traits in an index's order (for the type's own index, the order its
registration gives, most important first), joined by dots:
portrait.golden.pg.f.human.tan-skin.long-hair.straight-hair.black-hair.
A trait the asset lacks is an empty segment. The key names its type, and
the position says which trait a value belongs to, so a prefix
ending at a dot (portrait.golden.pg.f.) matches every asset of the type
whose leading traits are equal.
Constants
Recorded with each registered type; changing the format re-derives keys. 1 lacked the type prefix; 2 kept punctuation other than "." and ","; 3 let assets of a single-best type lose a key another held.
Class methods
The key of type's traits (in registration order) over normalized
values. A trait with a label reads value-label (tan-skin), for
traits whose values alone would be ambiguous to a reader, such as
several colours.
Keys are for matching, not display: Unicode case folding and NFC, then
letters and digits (in any script) kept, apostrophes dropped, and every
other run of punctuation, symbols or space turned into a single -.
"Zork III: The Dungeon Master" gives zork-iii-the-dungeon-master,
and a value never contains a separator. A value with no letters or
digits is no value.
A set trait's value: its comma-separated members, each normalized,
without duplicates, sorted and joined by commas
("Troll dead, trapdoor open" gives trapdoor-open,troll-dead). No
member can contain a comma, since normalizing turns commas into -.
An empty set is no value.
The prefix shared by every key of type whose first size traits have
these values; just the type for size 0. It ends at a separator, so it
never matches part of a value.