Fixed action cards briefly flashing dialog that wasn't needed

This commit is contained in:
ThaumRystra
2024-05-02 20:41:52 +02:00
parent 927fea9e8c
commit 445c2bb9c7

View File

@@ -5,6 +5,7 @@ import EngineActions, { EngineAction } from '/imports/api/engine/action/EngineAc
import InputProvider from '/imports/api/engine/action/functions/userInput/InputProvider'; import InputProvider from '/imports/api/engine/action/functions/userInput/InputProvider';
import applyAction from '/imports/api/engine/action/functions/applyAction'; import applyAction from '/imports/api/engine/action/functions/applyAction';
import { runAction } from '/imports/api/engine/action/methods/runAction'; 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 * 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 // Either way, call the action method afterwards
try { try {
const finishedAction = await applyAction( const finishedAction = await applyAction(
action, errorOnInputRequest, { simulate: true, task } action, getErrorOnInputRequestProvider(action._id), { simulate: true, task }
); );
return callActionMethod(finishedAction, task); return callActionMethod(finishedAction, task);
} catch (e) { } catch (e) {
@@ -76,10 +77,13 @@ const throwInputRequestedError = () => {
throw 'input-requested'; throw 'input-requested';
} }
const errorOnInputRequest: InputProvider = { function getErrorOnInputRequestProvider(actionId) {
nextStep: throwInputRequestedError, const errorOnInputRequest: InputProvider = {
rollDice: throwInputRequestedError, nextStep: throwInputRequestedError,
choose: throwInputRequestedError, rollDice: getDeterministicDiceRoller(actionId),
advantage: throwInputRequestedError, choose: throwInputRequestedError,
check: throwInputRequestedError, advantage: throwInputRequestedError,
check: throwInputRequestedError,
}
return errorOnInputRequest;
} }