Fix protoype object updates changing cached prototype #3507
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brief overview of PR changes/additions
Fixes behaviour in #3505.
This was caused by the spawned object being used as a comparison for the update directly updating the dict in the prototype cache if it found one, rather than copy of it. This resulted in the cached prototype being changed to reflect the spawned object.
Motivation for adding to Evennia
Bug fix.
Other info
Note that this does not change the repeated save request behaviour mentioned in the bug report.
Before
Starting with an object spawned from a prototype and then adding a new tag ('tag_on_object') directly to the object:
Add a new tag to the prototype:
Save and update spawned objects, then say "no" at the second save prompt:
View tags on prototype, without exiting the wizard:
Reload the prototype while still in the wizard. The prototype in the wizard now has the tags that the spawned object had before it was updated:
Note that the database has the correct tags. so
quitting the wizardrestarting the server and reloading the template will result in the correct tags.The spawned object has the new tag:
After
Starting from the same point as the start of the "before" test:
Go through the same steps to add a new tag, save, update, and say "no" at the second save prompt. Look at the tags on the prototype, without leaving the wizard:
Reload the prototype while staying in the wizard and check the tags:
The object has the new tag: