mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 12:11:07 +01:00
Added automation setting
This commit is contained in:
parent
958dd8b1d0
commit
ce2e5871bc
5 changed files with 33 additions and 3 deletions
|
|
@ -395,6 +395,9 @@ class RegisteredTriggers extends Map {
|
|||
|
||||
async runTrigger(trigger, currentActor, ...args) {
|
||||
const updates = [];
|
||||
const triggerSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).triggers;
|
||||
if (!triggerSettings.enabled) return updates;
|
||||
|
||||
const dualityTrigger = this.get(trigger);
|
||||
if (dualityTrigger) {
|
||||
for (let { actor, commands } of dualityTrigger.values()) {
|
||||
|
|
@ -402,8 +405,8 @@ class RegisteredTriggers extends Map {
|
|||
|
||||
for (let command of commands) {
|
||||
try {
|
||||
const commandUpdates = await command(...args);
|
||||
if (commandUpdates?.length) updates.push(...commandUpdates);
|
||||
const result = await command(...args);
|
||||
if (result?.updates?.length) updates.push(...result.updates);
|
||||
} catch (_) {
|
||||
const triggerName = game.i18n.localize(CONFIG.DH.TRIGGER.triggers[trigger].label);
|
||||
ui.notifications.error(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue