Groundwork for default libraries and slots

This commit is contained in:
Stefan Zermatten
2019-11-13 11:54:27 +02:00
parent ae0b060f01
commit eabc0aa32e
12 changed files with 116 additions and 23 deletions

View File

@@ -21,7 +21,7 @@ const insertCreature = new ValidatedMethod({
validate: null,
run(characterFormData) {
run() {
if (!this.userId) {
throw new Meteor.Error("Creatures.methods.insert.denied",
"You need to be logged in to insert a creature");
@@ -29,18 +29,9 @@ const insertCreature = new ValidatedMethod({
// Create the creature document
let charId = Creatures.insert({
name: characterFormData.name,
owner: this.userId,
alignment: characterFormData.alignment,
gender: characterFormData.gender,
race: characterFormData.race,
});
this.unblock();
if (Meteor.isServer){
//Add all the required attributes to it
let docs = getDefaultCharacterDocs(charId, characterFormData);
addDefaultDocs(docs);
}
return charId;
},