Fix drones used in unit transfer to rebuild units not being destroyed #6609
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.
Description of the proposed changes
Fixes a bug reported in Discord and shown in replay 23962051 where rebuilder drones were not getting cleaned up after use.
This is caused by the
rebuilders
table being indexed by the index oftrackers
, but this indexing can be skipped iftrackers.success
is true, which causesipairs
to not completely iterate overrebuilders
, causing some rebuilder drones to not be destroyed.Testing done on the proposed changes
Launch replay 23962051 from the branch
deploy/faf
at commit 805bdd3 with the logging commit cherrypicked on top. It will take around 11 minutes in-game for the bug to show, so you can usewld_RunWithTheWind
.The log will show that the tracker with the 2nd index fails, which causes the next iteration of rebuilders (for the next army) to create a rebuilder for tracker 2, but it doesn't iterate over
rebuilders = {[1] = nil, [2] = rebuilder}
, so rebuilder 2 is not destroyed.By adding in the commits that remove the
ipairs
iterators, the same replay shows that the rebuilders are all destroyed every army iteration despite tracker 2 failing.Checklist
- [ ] Changes are annotated, including comments where useful