mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Add toggle for party sheet
This commit is contained in:
parent
7d5cdeb09d
commit
aa4c8c83aa
3 changed files with 27 additions and 1 deletions
|
|
@ -2878,6 +2878,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Keybindings": {
|
"Keybindings": {
|
||||||
|
"partySheet": {
|
||||||
|
"name": "Toggle Party Sheet",
|
||||||
|
"hint": "Open or close the active party's sheet"
|
||||||
|
},
|
||||||
"spotlight": {
|
"spotlight": {
|
||||||
"name": "Spotlight Combatant",
|
"name": "Spotlight Combatant",
|
||||||
"hint": "Move the spotlight to a hovered or selected token that's present in an active encounter"
|
"hint": "Move the spotlight to a hovered or selected token that's present in an active encounter"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
export const keybindings = {
|
export const keybindings = {
|
||||||
spotlight: 'DHSpotlight'
|
spotlight: 'DHSpotlight',
|
||||||
|
partySheet: 'DHPartySheet'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const menu = {
|
export const menu = {
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,27 @@ export const registerKeyBindings = () => {
|
||||||
reservedModifiers: [],
|
reservedModifiers: [],
|
||||||
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL
|
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL
|
||||||
});
|
});
|
||||||
|
|
||||||
|
game.keybindings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.keybindings.partySheet, {
|
||||||
|
name: _loc('DAGGERHEART.SETTINGS.Keybindings.partySheet.name'),
|
||||||
|
hint: _loc('DAGGERHEART.SETTINGS.Keybindings.partySheet.hint'),
|
||||||
|
editable: [{ key: "KeyP" }],
|
||||||
|
onDown: () => {
|
||||||
|
const controlled = canvas.ready ? canvas.tokens.controlled : [];
|
||||||
|
const selectedParty = controlled.find((c) => c.actor?.type === 'party')?.actor;
|
||||||
|
const party = selectedParty ?? game.actors.party;
|
||||||
|
if (!party) return;
|
||||||
|
|
||||||
|
const sheet = party.sheet;
|
||||||
|
if (!sheet.rendered) {
|
||||||
|
sheet.render(true);
|
||||||
|
} else if (sheet.minimized) {
|
||||||
|
sheet.maximize();
|
||||||
|
} else {
|
||||||
|
sheet.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const registerMenuSettings = () => {
|
const registerMenuSettings = () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue