feat: use the selected token as speaker when performing a roll
This commit is contained in:
parent
3b2a7857e1
commit
0fa9d838e2
13 changed files with 57 additions and 61 deletions
|
@ -6,7 +6,7 @@ import { Check } from "../actor/actor-data-properties";
|
|||
import { DS4 } from "../config";
|
||||
import { getGame } from "../helpers";
|
||||
import notifications from "../ui/notifications";
|
||||
import { getActiveActor } from "./helpers";
|
||||
import { getActiveActorAndToken } from "./helpers";
|
||||
|
||||
/**
|
||||
* Creates a macro from a check drop.
|
||||
|
@ -45,10 +45,10 @@ async function getOrCreateRollCheckMacro(check: Check): Promise<Macro | undefine
|
|||
* Executes the roll check macro for the given check.
|
||||
*/
|
||||
export async function rollCheck(check: Check): Promise<void> {
|
||||
const actor = getActiveActor();
|
||||
const { actor, token } = getActiveActorAndToken();
|
||||
if (!actor) {
|
||||
return notifications.warn(getGame().i18n.localize("DS4.WarningMustControlActorToUseRollCheckMacro"));
|
||||
}
|
||||
|
||||
return actor.rollCheck(check).catch((e) => notifications.error(e, { log: true }));
|
||||
return actor.rollCheck(check, { speaker: { token } }).catch((e) => notifications.error(e, { log: true }));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue