adya / NPCs-Names-Distributor

A Framework to distriubte any names to any NPCs
MIT License
7 stars 3 forks source link

Refresh NNDData when reloading #28

Closed adya closed 1 year ago

adya commented 1 year ago

When reloading, cached NNDData entries must be updated if they have unresolved fields. So if title was not picked last time (e.g. originalName was used). Then this data needs to be regenerated, to see if title has changed.

For this feature to be efficient NND needs to save the composition of last used Name Definitions in form of pairs: NameDefinition's file name + checksum of that file.

Before loading NNDData entries, serializer should load this segment and determine whether data needs to be updated (e.g. whether composition of Name Definitions has changed since last time).

If changes are detected, then the following fields should be considered:

If those segments used default values (e.g. empty or defaultName or originalName) then an update is warranted.

UpdateDisplayName must also be called after that ~regardless of whether Name Definitions have changed, and/or any new names were picked, to account for possible change of DisplayName::format. (perhaps also cache last used format).~ Changes in options had also been added to snapshot.

adya commented 1 year ago

This feature can now indeed do additional name distribution for Name, Title and Obscuring name if they were previously set to default values (or empty) and new Name Definitions for them appeared.

Note that deletion of Name Definitions won't cause names to be "undistributed". For that, one would need to manually trigger regeneration.