Commit 174b9a6
# Objective
During despawn, commands are flushed before writing the `despawned_by`
location. This means that commands run by observers will not see the
updated value. It also means an entity spawned by one of those commands
that re-uses the entity index may have its `spawned_by` overwritten by
the `despawned_by` meant for the original entity.
## Solution
Move the call to `world.flush()` after the call to
`mark_spawn_despawn()`.
## Testing
Added a unit test demonstrating the issue.
1 parent 85b920b commit 174b9a6
1 file changed
+32
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2703 | 2703 | | |
2704 | 2704 | | |
2705 | 2705 | | |
2706 | | - | |
2707 | 2706 | | |
2708 | 2707 | | |
2709 | 2708 | | |
2710 | 2709 | | |
2711 | 2710 | | |
2712 | 2711 | | |
2713 | 2712 | | |
| 2713 | + | |
| 2714 | + | |
2714 | 2715 | | |
2715 | 2716 | | |
2716 | 2717 | | |
| |||
6765 | 6766 | | |
6766 | 6767 | | |
6767 | 6768 | | |
| 6769 | + | |
| 6770 | + | |
| 6771 | + | |
| 6772 | + | |
| 6773 | + | |
| 6774 | + | |
| 6775 | + | |
| 6776 | + | |
| 6777 | + | |
| 6778 | + | |
| 6779 | + | |
| 6780 | + | |
| 6781 | + | |
| 6782 | + | |
| 6783 | + | |
| 6784 | + | |
| 6785 | + | |
| 6786 | + | |
| 6787 | + | |
| 6788 | + | |
| 6789 | + | |
| 6790 | + | |
| 6791 | + | |
| 6792 | + | |
| 6793 | + | |
| 6794 | + | |
| 6795 | + | |
| 6796 | + | |
| 6797 | + | |
| 6798 | + | |
6768 | 6799 | | |
0 commit comments