Updated simpl-schema and collection2, started untangling the mess that made

This commit is contained in:
Stefan Zermatten
2018-10-12 13:38:51 +02:00
parent e3065f089f
commit 53a1137848
23 changed files with 337 additions and 138 deletions

View File

@@ -1,4 +1,5 @@
Features = new Mongo.Collection("features");
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
Schemas.Feature = new SimpleSchema({
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
@@ -13,13 +14,10 @@ Schemas.Feature = new SimpleSchema({
},
enabled: {type: Boolean, defaultValue: true},
alwaysEnabled:{type: Boolean, defaultValue: true},
color: {type: String,
allowedValues: _.pluck(colorOptions, "key"),
defaultValue: "q",
},
});
Features.attachSchema(Schemas.Feature);
Features.attachSchema(ColorSchema);
Features.helpers({
usesLeft: function(){
@@ -30,12 +28,9 @@ Features.helpers({
},
});
Features.attachBehaviour("softRemovable");
//Features.attachBehaviour("softRemovable");
makeParent(Features, ["name", "enabled"]); //parents of effects and attacks
Features.allow(CHARACTER_SUBSCHEMA_ALLOW);
Features.deny(CHARACTER_SUBSCHEMA_DENY);
//give characters default feature of base ability scores of 10
Characters.after.insert(function(userId, char) {
if (Meteor.isServer){