Presets
A preset is a named, reusable list of Rust item or entity shortnames. Define a list once (say, every
scientist type) and reference it as @presetName from any objective or condition field that takes an item or
entity list, instead of repeating the whole list in every contract.
Presets are stored in the preset_data.json data file and authored with the web
editor.
A preset has a display name, a list of one or more shortnames and an optional icon, stored under a key you choose:
{ "presets": { "Scientists": { "displayName": "Scientists", "displayNameTranslations": null, "values": [ "scientist2", "scientist2.heavy", "scientistnpc_oilrig", "scientistnpc_patrol" ], "icon": null, "iconColor": null, "iconRaw": false }, "Ballistas": { "displayName": "Ballistas", "displayNameTranslations": null, "values": [ "ballista.static", "ballista.mounted" ], "icon": null, "iconColor": null, "iconRaw": false } }, "version": { "Major": 1, "Minor": 16, "Patch": 1 }}The key is the identifier that @ references resolve against. displayName is the text players see, and
displayNameTranslations holds optional per-language overrides for it (see
Translating your content). The plugin ships with a ready-made @Scientists
preset (every scientist NPC type) plus a handful of others.
Fields
Section titled “Fields”| Field | Type | Default | Description |
|---|---|---|---|
displayName |
string | Label shown wherever the preset is referenced, like requirement chips. | |
displayNameTranslations |
object | null |
Per-language overrides for displayName. null when there are none. |
values |
array of string | The item or entity names the preset stands for. An item name takes the same shortname:skin form as an objective’s items list. |
|
icon |
string | null |
Direct image URL for the icon on this preset’s chips. null keeps the default icon. |
iconColor |
string | null |
Color for the icon, as hex (#rrggbb or #rrggbbaa), rgb() or rgba(). null keeps the color. |
iconRaw |
boolean | false |
Set true when the icon is a full-color image (a logo, custom art) so it renders in its own colors. |
Referencing a preset
Section titled “Referencing a preset”Anywhere a field takes an item or entity list (entities, items, containers, item, fish, bait, weapon
lists, and so on), you can write @presetName in place of a literal shortname. At load time the plugin expands the
reference into that preset’s list:
{ "type": "Kill", "title": "Hunt scientists", "amountRequired": 10, "conditions": {}, "entities": ["@scientists"]}You can mix preset references and literal shortnames in the same list, for example
["@scientists", "scarecrow"].
Naming a custom item
Section titled “Naming a custom item”A custom item (a base item with a skin) is written as shortname:skin, and a preset is the best place to keep it. With one skinned value and a displayName, every chip that references the preset shows your item’s name instead of the base item’s. See Targeting custom items for the walkthrough.
Nesting
Section titled “Nesting”A preset can reference other presets, so you can compose larger lists from smaller ones:
{ "presets": { "Weak NPCs": { "displayName": "Weak NPCs", "displayNameTranslations": null, "values": ["scarecrow", "murderer"] }, "All NPCs": { "displayName": "All NPCs", "displayNameTranslations": null, "values": ["@Scientists", "@Weak NPCs"] } }}References are expanded recursively at runtime.
See the Objectives overview for more on shortnames and how item and entity lists are matched.
