An generic system template for Svelte foundry systems
This system is compatible with v13+ only, as unfortunately v12's ui code was so painful I just did not want to deal with it.
Who might you thank?
The package will (ideally) be available directly via the foundry vtt module installer, under the id MY_SYSTEM_ID.
Alternatively, it can be installed via the manifest url:
https://github.com/MY_GITHUB/MY_SYSTEM_ID/releases/latest/download/system.json
How might people contribute?
Is accomplished by github actions. You must configure
Settings -> Secrets and variables -> Actions -> PACKAGE_TOKEN
to be the one provided by the foundry portal
The project can be built and run locally via the following steps.
npm run build
ln -s $(pwd)/dist /path/to/vtt/data/Data/systems/MY_SYSTEM_IDnpm ci and npm run build to populate the dist directory.
This will also need to be run to populate any asset files stored in the public directory,
if you should ever change those.vite.config.js to match whatever port you
are running foundry on on your local machine.
While running, all code changes should be hot (or at least lukewarm) reloaded in the vite proxy server.To add a new actor / item:
public/template.json to include it in the "Actor"."types" fieldpublic/languages/en.json to properly name the type in "TYPES"src/components/sheetssrc/sheets/ActorSheet.js or src/sheets/ItemSheet.jssrc/sheets/config.jssrc/models extending the appropriate supertypesrc/models/config.jsTo show a generic svelte component (say, a welcome window, a damage calculator, whatever), you can use the GenericComponentApp in src/apps/generic_app.js, supplying
To override a sidebar tab
Hooks.once('init', async function () in src/system.mjsCONFIG.ui.combat = CustomCombatTracker;CONFIG.ui property will depend on the tab you are editingTo add a new sidebar tab, e.x. a dedicated region for face cams
TODO: Polish this more
Add a new CustomSidebarTab class ```js export class CustomSidebarTab extends SvelteApplicationMixin(foundry.applications.sidebar.AbstractSidebarTab) { static DEFAULT_OPTIONS = { window: { title: "Whatever" }, svelte: { component: CustomSidebarComponent }, classes: ["MY_SYSTEM_ID"] }
static tabName = "whatever";
async _prepareContext() { // Yield some state return { "foo": "bar" }; }
} export class CustomSidebarTab extends foundry.applications.sidebar.AbstractSidebarTab { static DEFAULT_OPTIONS = { window: { title: "Whatever" }, svelte: { component: CustomSidebarComponent }, classes: ["MY_SYSTEM_ID"] }
static tabName = "whatever";
async _prepareContext() {
// Yield some state
return {
"foo": "bar"
};
}
}
- Add a new custom sidebar class to override the base behavior
```js
class CustomSidebar extends SvelteApplicationMixin(foundry.applications.sidebar.AbstractSidebarTab) {
getData(options={}) {
let base = super.getData(options);
base.tabs.custom = {
tooltip: "foo",
icon: "bar"
}
return base;
}
}
CONFIG.ui.sidebar = CustomSidebarTo override combat logic
src/system.mjs to no longer comment CONFIG.ui.combat = CustomCombatTracker;src/documents/token.js to not comment out _refreshTurnMarkersrc/documents/combat.js to include combat rules src/consts.js add a new constant to the sockets sub object representing your new socket eventsrc/utils/socket.svelte.js modify initSockets to handle your new constant with a special handlerWhat do you need help with?