Added default tags to properties
#type, damageType, skillType, attributeType, reset
This commit is contained in:
@@ -20,16 +20,28 @@ export default class CreatureComputation {
|
||||
// Store by id
|
||||
this.propsById[prop._id] = prop;
|
||||
|
||||
// Store tags
|
||||
const storePropOnTag = (prop, tag) => {
|
||||
if (!tag) return;
|
||||
if (this.propsWithTag[tag]){
|
||||
this.propsWithTag[tag].push(prop._id);
|
||||
} else {
|
||||
this.propsWithTag[tag] = [prop._id];
|
||||
}
|
||||
}
|
||||
// Store sets of ids in each tag
|
||||
if (prop.tags){
|
||||
prop.tags.forEach(tag => {
|
||||
if (this.propsWithTag[tag]){
|
||||
this.propsWithTag[tag].push(prop._id);
|
||||
} else {
|
||||
this.propsWithTag[tag] = [prop._id];
|
||||
}
|
||||
storePropOnTag(prop, tag);
|
||||
});
|
||||
}
|
||||
// Store tags for the property type
|
||||
storePropOnTag(prop, `#${prop.type}`);
|
||||
// Store tags for some string properties
|
||||
storePropOnTag(prop, prop.damageType);
|
||||
storePropOnTag(prop, prop.skillType);
|
||||
storePropOnTag(prop, prop.attributeType);
|
||||
storePropOnTag(prop, prop.reset);
|
||||
|
||||
// Store the prop in the dependency graph
|
||||
this.dependencyGraph.addNode(prop._id, prop);
|
||||
|
||||
Reference in New Issue
Block a user