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.
Changes
For
ProjectileCE
s which useGraphic_Collection
, cache the shadow data and then pick one at random each time the shadow is requestedReferences
Fixes CombatExtendedRWMod/#1075
Reasoning
This gets simple use cases of Graphic_Flicker or other collections functioning enough (no errors, not obviously wrong).
Alternatives
The shadows are not synchronized with the projectiles. The correct solution would be to add state tracking so the shadow will be synchronized. This could probably be done with a custom random number generator that always gives the same number twice before choosing another randomly. Since the projectile should get drawn, followed by the shadow, this would synchronize them. But it might break other things that use Graphic_Flicker.
We could also subclass Graphic_Flicker, or suggest other mods use a graphic class which doesn't flicker for things which spin.
Testing
Check tests you have performed: