// Fired when API is fully initialized
Hooks.once("stylish-action-hud.apiReady", (api) => {
// Safe to register adapters and extensions
});
// Fired when ActionMenu class is ready for registration
Hooks.once("stylish-action-hud.registerActionMenu", (ActionMenu) => {
// Direct access to ActionMenu class
});
// Modify action menu categories before rendering
Hooks.on("stylish-action-hud.modifyActionMenuCategories", (categories, actor) => {
// Add, remove, or modify categories
categories.push({
id: "custom",
label: "Custom",
icon: "fa-solid fa-star",
type: "submenu",
});
});
// Modify submenu data before rendering
Hooks.on("stylish-action-hud.modifyActionMenuData", (data, actor, categoryId) => {
// Modify items, tabs, or other data
if (categoryId === "custom-0") {
data.items["extra"] = [
{ id: "bonus", name: "Bonus Action", img: "icons/svg/bonus.svg" },
];
data.tabLabels["extra"] = "Extra";
}
});
The API provides convenient hook registration methods:
const api = game.modules.get("stylish-action-hud").api;
// These return the hook ID for later removal
const hookId1 = api.onModifyActionMenuCategories((categories, actor) => {
// Your modification logic
});
const hookId2 = api.onModifyActionMenuData((data, actor, categoryId) => {
// Your modification logic
});
// To remove hooks later
Hooks.off("stylish-action-hud.modifyActionMenuCategories", hookId1);
Hooks.off("stylish-action-hud.modifyActionMenuData", hookId2);