mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-10 19:17:09 +01:00
Added logging
This commit is contained in:
parent
9fb9ae1b91
commit
6f4ed1d6d9
2 changed files with 16 additions and 1 deletions
|
|
@ -78,6 +78,7 @@ CONFIG.ux.ContextMenu = applications.ux.DHContextMenu;
|
||||||
CONFIG.ux.TooltipManager = documents.DhTooltipManager;
|
CONFIG.ux.TooltipManager = documents.DhTooltipManager;
|
||||||
CONFIG.ux.TemplateManager = new TemplateManager();
|
CONFIG.ux.TemplateManager = new TemplateManager();
|
||||||
CONFIG.ux.TokenManager = new TokenManager();
|
CONFIG.ux.TokenManager = new TokenManager();
|
||||||
|
CONFIG.debug.triggers = false;
|
||||||
|
|
||||||
Hooks.once('init', () => {
|
Hooks.once('init', () => {
|
||||||
game.system.api = {
|
game.system.api = {
|
||||||
|
|
@ -501,7 +502,7 @@ class RegisteredTriggers extends Map {
|
||||||
if (dualityTrigger) {
|
if (dualityTrigger) {
|
||||||
const tokenBoundActors = ['adversary', 'environment'];
|
const tokenBoundActors = ['adversary', 'environment'];
|
||||||
const triggerActors = ['character', ...tokenBoundActors];
|
const triggerActors = ['character', ...tokenBoundActors];
|
||||||
for (let { actor: actorUuid, triggeringActorType, commands } of dualityTrigger.values()) {
|
for (let [itemUuid, { actor: actorUuid, triggeringActorType, commands }] of dualityTrigger.entries()) {
|
||||||
const actor = await foundry.utils.fromUuid(actorUuid);
|
const actor = await foundry.utils.fromUuid(actorUuid);
|
||||||
if (!actor || !triggerActors.includes(actor.type)) continue;
|
if (!actor || !triggerActors.includes(actor.type)) continue;
|
||||||
if (tokenBoundActors.includes(actor.type) && !actor.getActiveTokens().length) continue;
|
if (tokenBoundActors.includes(actor.type) && !actor.getActiveTokens().length) continue;
|
||||||
|
|
@ -514,6 +515,17 @@ class RegisteredTriggers extends Map {
|
||||||
|
|
||||||
for (let command of commands) {
|
for (let command of commands) {
|
||||||
try {
|
try {
|
||||||
|
if (CONFIG.debug.triggers) {
|
||||||
|
const item = await foundry.utils.fromUuid(itemUuid);
|
||||||
|
console.log(
|
||||||
|
game.i18n.format('DAGGERHEART.UI.ConsoleLogs.triggerRun', {
|
||||||
|
actor: actor.name ?? '<Missing Actor>',
|
||||||
|
item: item?.name ?? '<Missing Item>',
|
||||||
|
trigger: game.i18n.localize(triggerData.label)
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await command(...args);
|
const result = await command(...args);
|
||||||
if (result?.updates?.length) updates.push(...result.updates);
|
if (result?.updates?.length) updates.push(...result.updates);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
|
|
||||||
|
|
@ -2709,6 +2709,9 @@
|
||||||
"rerollDamage": "Reroll Damage",
|
"rerollDamage": "Reroll Damage",
|
||||||
"assignTagRoll": "Assign as Tag Roll"
|
"assignTagRoll": "Assign as Tag Roll"
|
||||||
},
|
},
|
||||||
|
"ConsoleLogs": {
|
||||||
|
"triggerRun": "DH TRIGGER | Item '{item}' on actor '{actor}' ran a '{trigger}' trigger."
|
||||||
|
},
|
||||||
"Countdowns": {
|
"Countdowns": {
|
||||||
"title": "Countdowns",
|
"title": "Countdowns",
|
||||||
"toggleIconMode": "Toggle Icon Only",
|
"toggleIconMode": "Toggle Icon Only",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue