Skip to content

Commit e29b004

Browse files
authored
Fhx the apply damage toggle not working (#517)
1 parent e6d714f commit e29b004

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

module/checks/common-sections.mjs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { CHECK_FLAVOR, CHECK_RESULT } from './default-section-order.mjs';
22
import { FUActor } from '../documents/actors/actor.mjs';
33
import { TargetAction, Targeting } from '../helpers/targeting.mjs';
44
import { ResourcePipeline } from '../pipelines/resource-pipeline.mjs';
5-
import { FU } from '../helpers/config.mjs';
5+
import { FU, SYSTEM } from '../helpers/config.mjs';
66
import { Flags } from '../helpers/flags.mjs';
77
import { Pipeline } from '../pipelines/pipeline.mjs';
88
import { TokenUtils } from '../helpers/token-utils.mjs';
99
import { TextEditor } from '../helpers/text-editor.mjs';
1010
import { InlineSourceInfo } from '../helpers/inline-helper.mjs';
11+
import { SETTINGS } from '../settings.js';
1112

1213
/**
1314
* @param {CheckRenderData} sections
@@ -255,26 +256,25 @@ const targeted = (sections, actor, item, targets, flags, checkData = undefined,
255256
}),
256257
);
257258

258-
if (game.dice3d) {
259-
Hooks.once('diceSoNiceRollComplete', () => {
260-
for (const target of targets) {
261-
showFloatyText(target, target.result === 'hit' ? 'FU.Hit' : 'FU.Miss');
262-
}
263-
});
264-
} else {
259+
function onRoll() {
265260
for (const target of targets) {
266261
showFloatyText(target, target.result === 'hit' ? 'FU.Hit' : 'FU.Miss');
267262
}
263+
if (damageData && game.settings.get(SYSTEM, SETTINGS.automationApplyDamage)) {
264+
setTimeout(() => {
265+
game.projectfu.socket.requestPipeline('damage', {
266+
sourceInfo: InlineSourceInfo.fromInstance(actor, item),
267+
targets,
268+
damageData,
269+
});
270+
}, 50);
271+
}
268272
}
269273

270-
if (damageData) {
271-
setTimeout(() => {
272-
game.projectfu.socket.requestPipeline('damage', {
273-
sourceInfo: InlineSourceInfo.fromInstance(actor, item),
274-
targets,
275-
damageData,
276-
});
277-
}, 50);
274+
if (game.dice3d) {
275+
Hooks.once('diceSoNiceRollComplete', onRoll);
276+
} else {
277+
onRoll();
278278
}
279279
}
280280

0 commit comments

Comments
 (0)