Fix known Enemy Randomizer crashes #2242
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.
The comment in the code should explain what this does pretty well.
The peahat tries to set a property of its parent which is normally a big peahat, but when spawned from anywhere else, that parent won't have that property to begin with, which leads to a crash when it dies. It only sets this property when it has a parent in the first place, so removing the parent is fine.
The floormaster tries to set its parent and child to another copy of itself when it dies and splits, which also crashes when the parent actor is already assigned/populated.
I've searched through every single instance of Actor_SpawnAsChild, and the only 3 times where it's used to spawn an enemy (that is eligible for randomization) is already handled through earlier changes I've made for Enemy Randomizer (see code comment).
I've also tested every single enemy in-game just to make sure I didn't miss any, and it's only the small peahats and floormasters that cause a crash when spawned as a child actor.
Build Artifacts