Refactored actions, 'cast a spell' task now works

This commit is contained in:
Thaum Rystra
2024-10-28 12:28:36 +02:00
parent 804c5f3aee
commit 8f8c9c28aa
39 changed files with 423 additions and 399 deletions

View File

@@ -1,6 +1,7 @@
import SimpleSchema from 'simpl-schema';
import TaskResult from './tasks/TaskResult';
import LogContentSchema from '/imports/api/creature/log/LogContentSchema';
import Task from './tasks/Task';
const EngineActions = new Mongo.Collection<EngineAction>('actions');
@@ -9,10 +10,9 @@ export interface EngineAction {
_isSimulation?: boolean;
_stepThrough?: boolean;
_decisions?: any[],
task: Task;
creatureId: string;
rootPropId?: string;
tabletopId?: string;
targetIds?: string[];
results: TaskResult[];
taskCount: number;
}
@@ -21,27 +21,25 @@ const ActionSchema = new SimpleSchema({
creatureId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
// @ts-expect-error index not defined
index: 1,
},
rootPropId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
optional: true,
},
tabletopId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
optional: true,
// @ts-expect-error index not defined
index: 1,
},
targetIds: {
type: Array,
optional: true,
task: {
type: Object,
blackbox: true,
},
'targetIds.$': {
type: String,
regEx: SimpleSchema.RegEx.Id,
},
// Applied properties
results: {
type: Array,