Prefabs
Prefabs are reusable arrangements of one or more configured tiles. Where a template is a complete GM screen loaded as a new session, a prefab is a smaller building block: GMs add it to any screen of any session from the canvas right-click menu, and the tiles appear at the point they clicked. A prefab might be a paired map and initiative tracker, a set of prepared note tiles, or a grouped reference block.
Creating a prefab
You can create a prefab by creating a definition in the plugin manifest.json file.
Example:
{
// [...]
"prefabs": [
{ "$ref": "prefabs/my-prefab/manifest.json" }
]
}You can also scaffold one with the CLI by selecting Prefab during npx @overseer-studio/sdk init.
Prefab definition
A prefab is defined by a manifest.json file containing an id, a label, and the tiles it inserts:
{
"$schema": "https://overseer.studio/schemas/prefab/manifest.json",
"id": "@scope/my-plugin-battle-pair",
"label": "Battle pair",
"tiles": [
{
"id": "tile-1",
"type": "@overseer/text",
"name": "Notes",
"config": { "value": "Session notes" },
"x": 0,
"y": 0,
"width": 480,
"height": 270
}
]
}A few things to know about the tiles payload:
- Positions are relative. Tile
x/yare offsets from the prefab’s own top-left corner. The app places the whole arrangement at the point the GM clicked. - Ids are regenerated. Tile ids only need to be unique within the prefab; every use stamps fresh ids, so the same prefab can be added many times.
- Group tiles work. A tile with
type: "group"andconfig.childTileIdsreferencing other tiles in the payload is inserted with its children and tabs intact. - Assets can be bundled. A tile config value may be a
{ "$ref": "assets/map.png" }pointing at a file inside the prefab folder; it resolves to the bundled file when the prefab is used.
Reference
Please reference https://overseer.studio/schemas/prefab/manifest.json for a complete definition of the file.