Closed ratacat closed 5 years ago
Object.assign() does a shallow copy so it's not the correct approach to have the metadata object not be shared. A better approach would be in the Character
constructor instead of
this.metadata = data.metadata || {};
do
if (data.metadata) {
this.metadata = JSON.parse(JSON.stringify(data.metadata));
} else {
this.metadata = {};
}
Creating a new pull request (#90) so we can close off this one. The commits were getting messy.
…luded in yaml
referenced here: https://github.com/RanvierMUD/ranviermud/issues/390 Currently if you define any metadata in an npcs.yml file, then all copies of that npc share a single metadata object. Not ideal! Being able to set metadata in yaml is quite useful though, and it would be a shame to not be able to do that.