Use DiceCloud 5e base as default for new characters
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
Reference in New Issue
Block a user