Actions targeting other creatures now works on both tabletop and character sheet
This commit is contained in:
@@ -11,7 +11,7 @@ export interface EngineAction {
|
||||
_decisions?: any[],
|
||||
creatureId: string;
|
||||
rootPropId?: string;
|
||||
tabletopId: string;
|
||||
tabletopId?: string;
|
||||
targetIds?: string[];
|
||||
results: TaskResult[];
|
||||
taskCount: number;
|
||||
|
||||
@@ -40,20 +40,20 @@ export default async function applyAction(action: EngineAction, userInput: Input
|
||||
action._isSimulation = simulate;
|
||||
action.taskCount = 0;
|
||||
let task = options?.task;
|
||||
console.log('task', task, action.targetIds)
|
||||
if (!task) {
|
||||
const prop = await getSingleProperty(action.creatureId, action.rootPropId);
|
||||
if (!prop) throw new Meteor.Error('Not found', 'Root action property could not be found');
|
||||
|
||||
// If the target ids weren't already set, get them from the user
|
||||
console.log(action.targetIds, prop);
|
||||
if (!action.targetIds && (
|
||||
prop.target === 'singleTarget' ||
|
||||
prop.target === 'multipleTargets'
|
||||
)) {
|
||||
console.log('getting targetIds');
|
||||
action.targetIds = await (userInput.targetIds(prop.targets));
|
||||
console.log('got targetIds', action.targetIds);
|
||||
if (
|
||||
!action.targetIds
|
||||
&& action.tabletopId
|
||||
&& (
|
||||
prop.target === 'singleTarget' ||
|
||||
prop.target === 'multipleTargets'
|
||||
)
|
||||
) {
|
||||
action.targetIds = await (userInput.targetIds(prop.target));
|
||||
}
|
||||
|
||||
task = {
|
||||
|
||||
Reference in New Issue
Block a user