diff --git a/app/imports/api/engine/computation/buildComputation/parseCalculationFields.js b/app/imports/api/engine/computation/buildComputation/parseCalculationFields.js index 43424732..7cfb333b 100644 --- a/app/imports/api/engine/computation/buildComputation/parseCalculationFields.js +++ b/app/imports/api/engine/computation/buildComputation/parseCalculationFields.js @@ -103,7 +103,7 @@ function subDocsExist(prop, key) { export function removeEmptyCalculations(prop) { prop._computationDetails.emptyCalculations.forEach(calcObj => { - if (!calcObj.effects?.length) { + if (!calcObj.effectIds?.length && !calcObj.proficiencyIds?.length) { unset(prop, calcObj._key); } }); diff --git a/app/imports/api/engine/loadCreatures.ts b/app/imports/api/engine/loadCreatures.ts index 67832026..51a0ca72 100644 --- a/app/imports/api/engine/loadCreatures.ts +++ b/app/imports/api/engine/loadCreatures.ts @@ -48,6 +48,7 @@ function unloadCreature(creatureId, subscription) { export function getSingleProperty(creatureId: string, propertyId: string) { const creature = loadedCreatures.get(creatureId) const property = creature?.properties.get(propertyId); + if (property?.removed) return; if (property) { return EJSON.clone(property); } @@ -64,8 +65,9 @@ export function getSingleProperty(creatureId: string, propertyId: string) { export function getProperties(creatureId: string): CreatureProperty[] { const creature = loadedCreatures.get(creatureId); if (creature) { - const props = Array.from(creature.properties.values()); - props.sort((a, b) => a.left - b.left); + const props = Array.from(creature.properties.values()) + .sort((a, b) => a.left - b.left) + .filter(prop => !prop.removed); return EJSON.clone(props); } // console.time(`Cache miss on creature properties: ${creatureId}`) @@ -82,13 +84,10 @@ export function getProperties(creatureId: string): CreatureProperty[] { export function getPropertiesOfType(creatureId, propType) { const creature = loadedCreatures.get(creatureId); if (creature) { - const props: CreatureProperty[] = [] - for (const prop of creature.properties.values()) { - if (prop.type === propType) { - props.push(prop); - } - } - props.sort((a, b) => a.left - b.left); + const props = Array.from( + creature.properties.values() + .filter(prop => !prop.removed && prop.type === propType) + ).sort((a, b) => a.left - b.left); return EJSON.clone(props); } // console.time(`Cache miss on creature properties: ${creatureId}`) @@ -112,13 +111,10 @@ export function getPropertiesOfType(creatureId, propType) { export function getPropertiesByFilter(creatureId, filterFn: (any) => boolean, mongoFilter: Mongo.Selector) { const creature = loadedCreatures.get(creatureId); if (creature) { - const props: CreatureProperty[] = [] - for (const prop of creature.properties.values()) { - if (filterFn(prop)) { - props.push(prop); - } - } - props.sort((a, b) => a.left - b.left); + const props: CreatureProperty[] = Array.from( + creature.properties.values() + .filter(filterFn) + ).sort((a, b) => a.left - b.left); return EJSON.clone(props); } // console.time(`Cache miss on creature properties: ${creatureId}`) @@ -235,7 +231,7 @@ export function getPropertyChildren(creatureId, property) { if (!creature) return []; const props: CreatureProperty[] = []; for (const prop of creature.properties.values()) { - if (prop.parentId === property._id) { + if (prop.parentId === property._id && prop.removed !== true) { props.push(prop); } } diff --git a/app/imports/api/sharing/SharingSchema.ts b/app/imports/api/sharing/SharingSchema.ts index 369974b6..e33413ed 100644 --- a/app/imports/api/sharing/SharingSchema.ts +++ b/app/imports/api/sharing/SharingSchema.ts @@ -1,5 +1,4 @@ import SimpleSchema from 'simpl-schema'; -import '/imports/api/sharing/sharing'; import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS'; export interface Shared { diff --git a/app/imports/client/ui/components/tree/TreeNode.vue b/app/imports/client/ui/components/tree/TreeNode.vue index e42082ca..3fc4ad8d 100644 --- a/app/imports/client/ui/components/tree/TreeNode.vue +++ b/app/imports/client/ui/components/tree/TreeNode.vue @@ -39,7 +39,6 @@ @@ -58,7 +57,6 @@ :organize="organize" :selected-node="selectedNode" :start-expanded="startExpanded" - :show-external-details="showExternalDetails" @move-within-root="e => $emit('move-within-root', e)" @move-between-roots="e => $emit('move-between-roots', e)" @selected="e => $emit('selected', e)" @@ -117,7 +115,6 @@ export default { }, selected: Boolean, startExpanded: Boolean, - showExternalDetails: Boolean, }, data() { return { diff --git a/app/imports/client/ui/components/tree/TreeNodeList.vue b/app/imports/client/ui/components/tree/TreeNodeList.vue index 51e7ddbd..94d80e02 100644 --- a/app/imports/client/ui/components/tree/TreeNodeList.vue +++ b/app/imports/client/ui/components/tree/TreeNodeList.vue @@ -23,7 +23,6 @@ :organize="organize" :lazy="lazy" :start-expanded="startExpanded" - :show-external-details="showExternalDetails" @selected="e => $emit('selected', e)" @move-within-root="e => $emit('move-within-root', e)" @move-between-roots="e => $emit('move-between-roots', e)" @@ -68,7 +67,6 @@ export default { default: () => [], }, startExpanded: Boolean, - showExternalDetails: Boolean, }, data() { return { diff --git a/app/imports/client/ui/creature/actions/doAction.ts b/app/imports/client/ui/creature/actions/doAction.ts index 293a78c1..3973cdcc 100644 --- a/app/imports/client/ui/creature/actions/doAction.ts +++ b/app/imports/client/ui/creature/actions/doAction.ts @@ -30,7 +30,7 @@ type DoActionParams = BaseDoActionParams & { * the decisions the user makes, then applying the action as a method call to the server with the * saved decisions, which will persist the action results. */ -export default async function doAction({ propId, creatureId, $store, elementId, task }: DoActionParams | DoTaskParams) { +export default async function doAction({ propId, creatureId, $store, elementId, task }: DoActionParams | DoTaskParams): Promise { if (!task) { if (!propId) throw new Meteor.Error('no-prop-id', 'Either propId or task must be provided'); task = { @@ -64,7 +64,7 @@ export default async function doAction({ propId, creatureId, $store, elementId, return callActionMethod(finishedAction); } catch (e) { if (e !== 'input-requested') throw e; - return new Promise(resolve => { + return new Promise((resolve, reject) => { $store.commit('pushDialogStack', { component: 'action-dialog', elementId, @@ -72,9 +72,14 @@ export default async function doAction({ propId, creatureId, $store, elementId, actionId, task, }, - callback(action: EngineAction) { - if (!action) return; - resolve(callActionMethod(action)); + async callback(action: EngineAction) { + try { + if (action) await callActionMethod(action); + resolve(); + } + catch (e) { + reject(e); + } return elementId; }, }); diff --git a/app/imports/client/ui/properties/components/actions/ActionCard.vue b/app/imports/client/ui/properties/components/actions/ActionCard.vue index ae7fa699..ab3dfce4 100644 --- a/app/imports/client/ui/properties/components/actions/ActionCard.vue +++ b/app/imports/client/ui/properties/components/actions/ActionCard.vue @@ -11,7 +11,7 @@ outlined style="font-size: 16px; letter-spacing: normal;" class="mr-2" - data-id="do-action-button" + :data-id="`${model._id}-do-action-button`" :color="model.color || 'primary'" :loading="doActionLoading" :disabled="model.insufficientResources || !context.editPermission || !!targetingError" @@ -89,7 +89,6 @@ { console.error(e); }).finally(() => { diff --git a/app/imports/client/ui/properties/components/effects/InlineEffect.vue b/app/imports/client/ui/properties/components/effects/InlineEffect.vue index 29553946..fdfed3c9 100644 --- a/app/imports/client/ui/properties/components/effects/InlineEffect.vue +++ b/app/imports/client/ui/properties/components/effects/InlineEffect.vue @@ -33,16 +33,22 @@