Fixed #2878 Missing Bay Door on reload. #2879
Merged
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.
Fixes #2878
Found and fixed an issue that occurs when a dropship bay door is scrapped and repaired. The
MissingBayDoor::fix()
method was removing itself prior to adding the actual part. The side-effect of theremove()
function is that is rendersthis.parentPart
null therefore unable to complete the critical next step of linking the child/parent relationship to the actual part.I could have just moved the
remove
method below setting the actual part relationship, but thought this side effect needed to be documented here to make the reader of this code aware of the side effect.The impact of the original code was that the bay door was being added, but the Transport Bay containing the door did not reference it nor did the new fixed bay door reference the transport bay. As a result, whenever the file is reloaded, it looks like the bay door is missing. (because it's orphaned).