Fixed creature templates added to tabletops not getting their properties set

This commit is contained in:
ThaumRystra
2024-11-09 15:44:06 +02:00
parent 7c648f67a3
commit 3949ea3448
3 changed files with 20 additions and 8 deletions

View File

@@ -88,14 +88,17 @@ const addCreaturesFromLibraryToTabletop = new ValidatedMethod({
});
function insertSubProperties(node, creatureId: string) {
console.log({ node, })
let nodes = LibraryNodes.find({
...getFilter.descendants(node),
removed: { $ne: true },
}).fetch();
console.log('found nodes', nodes);
for (const node of nodes) {
node.root = {
'_id': creatureId,
id: creatureId,
collection: 'creatures',
};
}
@@ -113,6 +116,7 @@ function insertSubProperties(node, creatureId: string) {
});
// Insert the creature properties
console.log('final nodes', nodes);
// @ts-expect-error Batch insert not defined
if (nodes.length) CreatureProperties.batchInsert(nodes);
return node;

View File

@@ -1,28 +1,28 @@
<template lang="html">
<div class="creature-template-form">
<v-row dense>
<v-row>
<v-col
cols="12"
md="6"
>
<text-field
label="Picture URL"
<smart-image-input
label="Picture"
hint="A link to a high resolution image"
:value="model.picture"
:error-messages="errors.picture"
@change="change('picture', ...arguments)"
@change="(value, ack) => $emit('change', {path: ['picture'], value, ack})"
/>
</v-col>
<v-col
cols="12"
md="6"
>
<text-field
label="Avatar picture URL"
<smart-image-input
label="Avatar"
hint="A link to a smaller, square image to use as an avatar"
:value="model.avatarPicture"
:error-messages="errors.avatarPicture"
@change="change('avatarPicture', ...arguments)"
@change="(value, ack) => $emit('change', {path: ['avatarPicture'], value, ack})"
/>
</v-col>
</v-row>
@@ -46,8 +46,12 @@
<script lang="js">
import propertyFormMixin from '/imports/client/ui/properties/forms/shared/propertyFormMixin';
import SmartImageInput from '/imports/client/ui/components/global/SmartImageInput.vue';
export default {
components: {
SmartImageInput,
},
mixins: [propertyFormMixin],
}
</script>

View File

@@ -112,6 +112,10 @@ Meteor.publish('tabletop', function (tabletopId) {
initiativeRoll: 1,
settings: 1,
propCount: 1,
readers: 1,
writers: 1,
owner: 1,
public: 1,
},
limit: 110, // Party vs 100 creatures was a fun encounter to run, so let's support that
});