Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CrocoDamageTypeController Support For DamageAPI #514

Merged
merged 4 commits into from
May 27, 2024

Conversation

yekoc
Copy link
Contributor

@yekoc yekoc commented Jan 8, 2024

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)

@yekoc
Copy link
Contributor Author

yekoc commented Jan 9, 2024

Solved delayed work consideration by making HasModdedDamageType checks lazily evaluate the conversion,this doesn't affect semantics due to the modification being invisible from the outside.This is the case as any pre-modification copies would also copy the signal to modify.

@yekoc yekoc marked this pull request as ready for review January 9, 2024 00:32
@xiaoxiao921 xiaoxiao921 merged commit 0f18782 into risk-of-thunder:master May 27, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants