Progress on action choices
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { EngineAction } from '/imports/api/engine/action/EngineActions';
|
||||
import { getSingleProperty } from '/imports/api/engine/loadCreatures';
|
||||
import applyTask from '/imports/api/engine/action/tasks/applyTask'
|
||||
import InputProvider from '/imports/api/engine/action/functions/InputProvider';
|
||||
import InputProvider from '/imports/api/engine/action/functions/userInput/InputProvider';
|
||||
import saveInputChoices from './userInput/saveInputChoices';
|
||||
|
||||
// TODO create a function to get the effective value of a property,
|
||||
// simulating all the result updates in the action so far
|
||||
@@ -17,6 +18,16 @@ export default async function applyAction(action: EngineAction, userInput: Input
|
||||
if (!simulate && stepThrough) throw 'Cannot step through unless simulating';
|
||||
if (simulate && !userInput) throw 'Must provide a function to get user input when simulating';
|
||||
|
||||
if (action._isSimulation || action._stepThrough) {
|
||||
console.error('_isSimulation and _stepThrough should not be set on the action, rather call\
|
||||
applyAction with the appropriate options');
|
||||
}
|
||||
|
||||
// If we are simulating, save the user input choices
|
||||
if (simulate) {
|
||||
userInput = saveInputChoices(action, userInput);
|
||||
}
|
||||
|
||||
action._stepThrough = stepThrough;
|
||||
action._isSimulation = simulate;
|
||||
action.taskCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user