Action interruption progress

This commit is contained in:
Thaum Rystra
2024-03-26 23:25:18 +02:00
parent 57220c7972
commit e083490cb3
12 changed files with 184 additions and 62 deletions

View File

@@ -20,6 +20,15 @@ export default async function applyTask(
export default async function applyTask(
action: EngineAction, task: Task, inputProvider: InputProvider
): Promise<void | number> {
// Pause and wait for the user if the action is being stepped through
console.log('applying task', action, inputProvider)
if (action._isSimulation && action._stepThrough && inputProvider.nextStep) {
console.log('waiting for next step resolution', task)
await inputProvider.nextStep(task);
}
// Ensure no more than 100 tasks are performed by a single action
action.taskCount += 1;
if (action.taskCount > 100) throw 'Only 100 properties can be applied at once';