content
INFO
Сам справочник на английском: он создаётся автоматически из WIT-файлов.
(0.3) Content a mod declares in [content] of mod.toml and the numeric ids the world gave it, plus cosmetics: a server mod puts one of its own cosmetics on a player and the modded clients draw it.
Package blockheads:api@0.3.1 · Lua table bh.content · WIT source
Uses: types.{api-error}, players.{player}
Types
kind enum
A kind of content.
| Case | Description |
|---|---|
block | A block. |
item | An item. |
cosmetic | A cosmetic (hat, shirt, pants, shoes, hair, weapon skin). |
cosmetic-info record
A cosmetic of a loaded mod.
| Field | Type | Description |
|---|---|---|
key | string | <mod-id>:<name>. |
mod-id | string | The mod that declares it. |
slot | string | hat, shirt, pants, shoes, hair or weapon. |
id | option<u32> | The world's id; none on hosts that keep no registry. |
Functions
id-of function
id-of: func(kind: kind, key: string) -> option<u32>;The id this world gave a declared key; none for an unknown key or on hosts without a registry.
key-of function
key-of: func(kind: kind, id: u32) -> option<string>;The key of an id; none when unknown.
cosmetics function
cosmetics: func() -> list<cosmetic-info>;The cosmetics of all loaded mods.
equipped function
equipped: func(who: borrow<player>) -> result<list<tuple<string, string>>, api-error>;What a player wears as (slot, key) pairs.
equip function
equip: func(who: borrow<player>, key: string) -> result<_, api-error>;Puts one of the calling mod's cosmetics on a player, replacing the one in its slot. Other mods' keys give not-permitted, unknown keys invalid-argument, a player who left stale-handle; clients get unsupported.
unequip function
unequip: func(who: borrow<player>, slot: string) -> result<_, api-error>;Takes the cosmetic of slot off a player.