data/loot_tables/
A loot table: what a creature drops or a container holds, in Minecraft’s shape. Each pool rolls a number of times and each roll picks one entry by weight among those whose conditions hold; functions then change the counts. Rolls are deterministic per source, so replays and previews drop the same items. An archetype’s death names its table; tables can nest. Entries name item kinds. Loaded by the server only.
| Registry | manifold:loot-table |
| Files | data/loot_tables/*.ron, *.update.ron, *.final.ron |
| Sides | server: only the server loads it |
| Reads | manifold:predicate |
| Contract | Gameplay framework, data stage |
Entry
A record, written LootTable(..); the name before the parentheses is optional.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The table’s key, <mod-id>:<path> (flagship-game:entities/boar). | |
context | LootContext | no | LootEntity | What a roll can read. |
pools | list of Pool | no | none | The pools, each rolled in turn. |
functions | list of LootFunction | no | none | Functions applied to everything the table yields. |
Example
From tools/test-mods/guide-creature/data/loot_tables/razorback.ron:
LootTable(
id: "guide-creature:entities/razorback",
context: LootEntity,
pools: [
Pool(rolls: Const(1), entries: [
Item(item: "guide-creature:bristle", weight: 3,
functions: [SetCount(Uniform(min: Const(2), max: Const(5)))]),
Item(item: "flagship-game:boar_tusk", weight: 1, quality: 2),
]),
],
)
Types
LootContext
A loot table’s context.
| Variant | Written | Description |
|---|---|---|
LootEntity | LootEntity | A creature’s drops: conditions may read the victim (This) and its killer (Killer, KillerPlayer). |
LootGeneric | LootGeneric | Drops without a killer, such as a container; the opener is This. |
Pool
A pool of a loot table.
A record: Pool(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
rolls | number | no | 1 | How many times it rolls (at most 16 in all). |
bonus_rolls | number | no | 0 | Extra rolls per point of luck, floored. |
conditions | list of condition | no | none | Conditions that must all hold for the pool to roll. |
entries | list of LootEntry | no | none | The entries a roll picks from. |
functions | list of LootFunction | no | none | Functions applied to what the pool yields. |
LootEntry
An entry a pool’s roll may pick. Every entry may also give weight, quality, conditions and functions.
| Variant | Written | Description |
|---|---|---|
Item | Item(item: .., weight: .., quality: .., conditions: .., functions: ..) | One item kind. |
Table | Table(table: .., weight: .., quality: .., conditions: .., functions: ..) | Rolls another loot table, with its own draws (at most four deep, no cycles, and a context within this table’s). |
Empty | Empty(weight: .., quality: .., conditions: .., functions: ..) | Nothing: a weighted chance of no drop. |
Alternatives | Alternatives(children: .., weight: .., quality: .., conditions: .., functions: ..) | The first child whose conditions hold. |
Group | Group(children: .., weight: .., quality: .., conditions: .., functions: ..) | Every child whose conditions hold. |
Item fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
item | string | yes | The item kind (manifold:item-kind key). An unknown key fails the data stage (DATA010). | |
weight | u32 | no | 1 | Its weight among the roll’s entries. |
quality | i32 | no | 0 | Weight added per point of luck, floored. |
conditions | list of condition | no | none | Conditions that must all hold for the entry to be picked. |
functions | list of LootFunction | no | none | Functions applied to what it yields. |
Table fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
table | string | yes | The table (manifold:loot-table key). | |
weight | u32 | no | 1 | Its weight among the roll’s entries. |
quality | i32 | no | 0 | Weight added per point of luck, floored. |
conditions | list of condition | no | none | Conditions that must all hold for the entry to be picked. |
functions | list of LootFunction | no | none | Functions applied to what it yields. |
Empty fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
weight | u32 | no | 1 | Its weight among the roll’s entries. |
quality | i32 | no | 0 | Weight added per point of luck, floored. |
conditions | list of condition | no | none | Conditions that must all hold for the entry to be picked. |
functions | list of LootFunction | no | none | Functions; nothing to apply them to. |
Alternatives fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
children | list of LootEntry | no | none | The children, in order. |
weight | u32 | no | 1 | Its weight among the roll’s entries. |
quality | i32 | no | 0 | Weight added per point of luck, floored. |
conditions | list of condition | no | none | Conditions that must all hold for the entry to be picked. |
functions | list of LootFunction | no | none | Functions applied to what it yields. |
Group fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
children | list of LootEntry | no | none | The children. |
weight | u32 | no | 1 | Its weight among the roll’s entries. |
quality | i32 | no | 0 | Weight added per point of luck, floored. |
conditions | list of condition | no | none | Conditions that must all hold for the entry to be picked. |
functions | list of LootFunction | no | none | Functions applied to what it yields. |
LootFunction
A function that changes what an entry, pool or table yields.
| Variant | Written | Description |
|---|---|---|
SetCount | SetCount(number) | Sets the count to a number (SetCount(Uniform(min: Const(1), max: Const(3)))). |
AddCount | AddCount(number) | Adds a number to the count. |
LimitCount | LimitCount(min: .., max: ..) | Clamps the count. |
Conditional | Conditional(when: .., then: ..) | Applies then only when when holds. |
LimitCount fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
min | u16 | yes | The smallest count. | |
max | u16 | yes | The largest count, at least min. |
Conditional fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
when | condition | yes | The condition. | |
then | LootFunction | yes | The function. |