Re-wrote parenting, should be significantly faster, more maintainable

This commit is contained in:
Stefan Zermatten
2019-03-08 13:57:24 +02:00
parent 15c11e16ab
commit febb65a513
10 changed files with 339 additions and 264 deletions

View File

@@ -1,8 +1,8 @@
import SimpleSchema from 'simpl-schema';
import schema from '/imports/api/schema.js';
import {makeChild} from '/imports/api/parenting.js';
import AdjustmentSchema from '/imports/api/creature/subSchemas/AdjustmentSchema.js';
import DamageSchema from '/imports/api/creature/subSchemas/DamageSchema.js';
import PropertySchema from '/imports/api/creature/subSchemas/PropertySchema.js';
import ChildSchema from '/imports/api/parenting/ChildSchema.js';
let Actions = new Mongo.Collection('actions');
@@ -10,20 +10,11 @@ let Actions = new Mongo.Collection('actions');
* Actions are given to a character by items and features
*/
let actionSchema = schema({
charId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
index: 1,
},
name: {
type: String,
optional: true,
trim: false,
},
enabled: {
type: Boolean,
defaultValue: true,
},
description: {
type: String,
optional: true,
@@ -52,8 +43,9 @@ let actionSchema = schema({
});
Actions.attachSchema(actionSchema);
Actions.attachSchema(PropertySchema);
Actions.attachSchema(ChildSchema);
// Actions.attachBehaviour('softRemovable');
makeChild(Actions, ["name", "enabled"]);
// makeChild(Actions, ["name", "enabled"]);
export default Actions

View File

@@ -0,0 +1,16 @@
import SimpleSchema from 'simpl-schema';
import schema from '/imports/api/schema.js';
const PropertySchema = schema({
charId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
index: 1,
},
enabled: {
type: Boolean,
defaultValue: true,
},
});
export default PropertySchema;