From 445c2bb9c7b0aa3b53585f47dc6742583861b047 Mon Sep 17 00:00:00 2001 From: ThaumRystra <9525416+ThaumRystra@users.noreply.github.com> Date: Thu, 2 May 2024 20:41:52 +0200 Subject: [PATCH] Fixed action cards briefly flashing dialog that wasn't needed --- .../client/ui/creature/actions/doAction.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/imports/client/ui/creature/actions/doAction.ts b/app/imports/client/ui/creature/actions/doAction.ts index a04df490..c07b3a48 100644 --- a/app/imports/client/ui/creature/actions/doAction.ts +++ b/app/imports/client/ui/creature/actions/doAction.ts @@ -5,6 +5,7 @@ import EngineActions, { EngineAction } from '/imports/api/engine/action/EngineAc import InputProvider from '/imports/api/engine/action/functions/userInput/InputProvider'; import applyAction from '/imports/api/engine/action/functions/applyAction'; import { runAction } from '/imports/api/engine/action/methods/runAction'; +import getDeterministicDiceRoller from '/imports/api/engine/action/functions/userInput/getDeterministicDiceRoller'; /** * Apply an action on the client that first creates the action on both the client and server, then @@ -44,7 +45,7 @@ export default async function doAction( // Either way, call the action method afterwards try { const finishedAction = await applyAction( - action, errorOnInputRequest, { simulate: true, task } + action, getErrorOnInputRequestProvider(action._id), { simulate: true, task } ); return callActionMethod(finishedAction, task); } catch (e) { @@ -76,10 +77,13 @@ const throwInputRequestedError = () => { throw 'input-requested'; } -const errorOnInputRequest: InputProvider = { - nextStep: throwInputRequestedError, - rollDice: throwInputRequestedError, - choose: throwInputRequestedError, - advantage: throwInputRequestedError, - check: throwInputRequestedError, +function getErrorOnInputRequestProvider(actionId) { + const errorOnInputRequest: InputProvider = { + nextStep: throwInputRequestedError, + rollDice: getDeterministicDiceRoller(actionId), + choose: throwInputRequestedError, + advantage: throwInputRequestedError, + check: throwInputRequestedError, + } + return errorOnInputRequest; }