CrocoDamageTypeController Support For DamageAPI #514
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.
Not being able to support modded damage types made CrocoDamageTypeController almost entirely useless for mods and made compatibility between mods adding new passives to Acrid difficult.
However it's conceptually really useful,so here is an effort to make it work like we'd want it to.Includes additions to CompressedFlagArrayUtilities to facilitate non-destructive copying of ModdedDamageTypeHolders
Draft PR currently only implements support for projectiles,putting it up to gather feedback on changes to API surface and on the following:
The transfer of modded damage types from the holder assigned to the CrocoDamageTypeController needs to be deferred due to the way the vanilla component is setup (which is why it was such a pain),signalling for this is available through the remaining unused vanilla damage type.While projectiles have a very convenient place to do this in (ProjectileManager.InitProjectile),there is no direct equivalent to handle non-projectile attacks.
One option to keep the implementation simple is to delay this operation until TakeDamage/OnHitAll,this seems ideal but makes it so that the damage type coming from the CrocoDamageTypeController is not visible to checks before that point (HasModdedDamageType on a BulletAttack,for example).
The opposite approach would be to check for the signal and perform it in every current hook,this guarantees total visiblity for the moddeddamagetypes in question but will complicate the implementation. (Might cause performance/maintenance burden)