Esta página ainda não foi traduzida para português, por isso a versão em inglês é exibida abaixo.
MaisGameplay tags
pkg/tags provides a strict versioned YAML registry, reference-counted hierarchical containers, and all/any/none queries for shared ability, AI, item, and UI vocabularies.
Registry
tags.Parse reads a registry file and tags.Encode writes it back with the tags sorted by name (the example is on File Formats). Unknown fields, trailing YAML documents, a missing or unsupported version and an invalid or repeated name are refused with a *loaderr.Error naming the line.
| Field | Type | Meaning |
|---|---|---|
version |
int | Always 1 |
tags[].name |
string | Dot-separated segments, each a letter followed by letters, digits, _ or -, such as status.debuff.stun; each segment names a child of the tag before it |
tags[].description |
string, optional | What the tag means |
Registry.Has(name) reports whether the registry declares a name exactly.
Containers and queries
A Container holds the tags one entity has, each with a reference count, so two sources that grant the same tag do not remove each other's grant: Add adds one reference, Remove drops one and removes the tag with its last. Add ignores an invalid name.
A child tag implies its parents. Container.Has("status.debuff") is true when the container holds status.debuff or any tag under it, such as status.debuff.stun, but holding only status.debuff does not match status.debuff.stun. HasExact matches the name itself only. A Query with all, any and none lists compares each tag the way Has does: Match requires every all tag, at least one any tag when the list is not empty, and no none tag.