diff --git a/app/imports/api/creature/Creatures.js b/app/imports/api/creature/Creatures.js index bc240371..422d2f7c 100644 --- a/app/imports/api/creature/Creatures.js +++ b/app/imports/api/creature/Creatures.js @@ -8,7 +8,7 @@ import CreatureProperties from '/imports/api/creature/creatureProperties/Creatur import {assertEditPermission} from '/imports/api/sharing/sharingPermissions.js'; import { assertUserHasPaidBenefits } from '/imports/api/users/patreon/tiers.js'; import defaultCharacterProperties from '/imports/api/creature/defaultCharacterProperties.js'; - +import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js'; import '/imports/api/creature/removeCreature.js'; import '/imports/api/creature/restCreature.js'; @@ -202,10 +202,23 @@ const insertCreature = new ValidatedMethod({ // Insert the default properties // Not batchInsert because we want the properties cleaned by the schema + let baseId; defaultCharacterProperties(creatureId).forEach(prop => { - CreatureProperties.insert(prop); + let id = CreatureProperties.insert(prop); + if (prop.name === 'Ruleset'){ + baseId = id; + } }); + if (Meteor.isServer){ + // Insert the 5e ruleset as the default base + insertPropertyFromLibraryNode.call({ + nodeId: 'iHbhfcg3AL5isSWbw', + parentRef: {id: baseId, collection: 'creatureProperties'}, + order: 0.5, + }); + } + this.unblock(); return creatureId; }, diff --git a/app/imports/api/creature/defaultCharacterProperties.js b/app/imports/api/creature/defaultCharacterProperties.js index 864555b6..a38f24ea 100644 --- a/app/imports/api/creature/defaultCharacterProperties.js +++ b/app/imports/api/creature/defaultCharacterProperties.js @@ -1,31 +1,5 @@ import BUILT_IN_TAGS from '/imports/constants/BUILT_IN_TAGS.js'; -const properties = [ - { - type: 'propertySlot', - name: 'Base', - description: 'Choose a starting point for your character, this will define the basic setup of your character sheet. Without a base, your sheet will be empty.', - slotTags: ['base'], - tags: [], - quantityExpected: 1, - hideWhenFull: true, - spaceLeft: 1, - totalFilled: 0, - }, { - type: 'folder', - name: 'Inventory', - tags: [BUILT_IN_TAGS.inventory], - }, { - type: 'folder', - name: 'Equipment', - tags: [BUILT_IN_TAGS.equipment], - }, { - type: 'folder', - name: 'Carried', - tags: [BUILT_IN_TAGS.carried], - }, -]; - export default function defaultCharacterProperties(creatureId){ if (!creatureId) throw 'creatureId is required'; const creatureRef = {collection: 'creatures', id: creatureId}; @@ -35,7 +9,7 @@ export default function defaultCharacterProperties(creatureId){ return [ { type: 'propertySlot', - name: 'Base', + name: 'Ruleset', description: 'Choose a starting point for your character, this will define the basic setup of your character sheet. Without a base, your sheet will be empty.', slotTags: ['base'], tags: [],