Added Soft remove and a character asset parenting system
This commit is contained in:
@@ -22,20 +22,8 @@ Features.helpers({
|
||||
}
|
||||
});
|
||||
|
||||
//Delete effects where this the removed feature is source
|
||||
Features.before.remove(function (userId, feature) {
|
||||
Effects.find({sourceId: feature._id, type: "feature"}).forEach(function(effect){
|
||||
Effects.remove(effect._id);
|
||||
});
|
||||
});
|
||||
|
||||
//keep the effects up to date with enabled state
|
||||
Features.after.update(function (userId, feature, fieldNames, modifier, options) {
|
||||
var enabled = feature.enabled !== "disabled";
|
||||
Effects.find({sourceId: feature._id, type: "feature"}).forEach(function(effect){
|
||||
Effects.update(effect._id, { $set: {charId: feature.charId, enabled: enabled, name: feature.name} });
|
||||
});
|
||||
}, {fetchPrevious: false});
|
||||
Features.attachBehaviour('softRemovable');
|
||||
makeParent(Features); //parents of effects and attacks
|
||||
|
||||
Features.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||
Features.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||
|
||||
Reference in New Issue
Block a user