[ENHANCEMENT] let modules interact with each other during onDestroy #3131
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.
Briefly describe the issue(s) fixed.
currently, interaction between modules in
onDestroy
is unreliable as they are currently removed from the module list as they are iterated through instead of afterthe module priority currently cannot be used to fix this since map iteration is unordered
i have a use case right now where id like to retrieve a value in a module from another module (a bool used to conditionally manage a set of sprites), but trying to retrieve the value will randomly error because
ModuleHandler
will attempt to grab the module after it has been removed from the cachewhile in this case i can make a workaround by setting a variable to that bool before the reload starts, there arent any workarounds for functions....
this pr simply just removes that removal during the iteration (
clear()
functionally does the same thing anyways)