mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Added system keybind for spotlighting a combatant (#1749)
This commit is contained in:
parent
eb9e47c39d
commit
a4adbf8ac4
8 changed files with 64 additions and 1 deletions
1
module/macros/_modules.mjs
Normal file
1
module/macros/_modules.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as spotlightCombatant } from './spotlightCombatant.mjs';
|
||||
21
module/macros/spotlightCombatant.mjs
Normal file
21
module/macros/spotlightCombatant.mjs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Spotlights a combatant.
|
||||
* The combatant can be selected in a number of ways. If many are applied at the same time, the following order is used:
|
||||
* 1) SelectedCombatant
|
||||
* 2) HoveredCombatant
|
||||
*/
|
||||
const spotlightCombatant = () => {
|
||||
if (!game.combat)
|
||||
return ui.notifications.error(game.i18n.localize('DAGGERHEART.MACROS.Spotlight.errors.noActiveCombat'));
|
||||
|
||||
const selectedCombatant = canvas.tokens.controlled.length > 0 ? canvas.tokens.controlled[0].combatant : null;
|
||||
const hoveredCombatant = game.canvas.tokens.hover?.combatant;
|
||||
|
||||
const combatant = selectedCombatant ?? hoveredCombatant;
|
||||
if (!combatant)
|
||||
return ui.notifications.error(game.i18n.localize('DAGGERHEART.MACROS.Spotlight.errors.noCombatantSelected'));
|
||||
|
||||
ui.combat.setCombatantSpotlight(combatant.id);
|
||||
};
|
||||
|
||||
export default spotlightCombatant;
|
||||
Loading…
Add table
Add a link
Reference in a new issue