Skip to content
Contractsv1.9.0

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": 9,
"Patch": 0
}
}

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.

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.
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.

Anywhere a field takes an item or entity list (entities, items, 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"].

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.