space-station-14
space-station-14 copied to clipboard
Combine solution injection systems; Fix embeddable injectors
About the PR
Reduced code duplication between injection systems and fixed some bugs.
Why / Balance / Technical details
After fixing injections from reflected projectiles in #26141, it was reported that embeddable injectors weren't working (#26233).
This gave me the idea to split SolutionInjectOnCollide into two components/systems to handle projectiles and embeds separately. I realized that there would be some gross code reuse, so I switched to making a single SolutionInjectOnEventSystem handles behavior for SolutionInjectOnProjectileHitComponent and SolutionInjectOnEmbedComponent, using BaseSolutionInjectOnEventComponent as a common base. This also removes the need to specify FixtureId, since the collisions are processed by the events.
While implementing that, I noticed that MeleeChemicalInjector was nearly identical to SolutionInjectOnCollide, for both the component and the system. So I refactored that to also inherit from BaseSolutionInjectOnEventComponent and go through SolutionInjectOnEventSystem. Code duplication begone!
This also gives both systems features that were previously added to one but not the other. Hardsuits can now block injections from projectiles without the PierceArmor field set to true (though the implementation is still ugly and should be reworked), and melee weapon injections can use the BlockSlots feature that was previously only on the OnCollide component. BlockSlots also didn't seem to be working; now it is.
Fixes #26233. From what I can tell, also fixes #20708. Provides one possible way of addressing #20699.
Media
Code.
- [X] I have added screenshots/videos to this PR showcasing its changes ingame, or this PR does not require an ingame showcase
Breaking changes
SolutionInjectOnCollideComponent and SolutionInjectOnCollideSystem have been removed.
Replace SolutionInjectOnCollide components in entity prototypes with SolutionInjectOnProjectileHit or SolutionInjectOnEmbed, depending on desired behavior.
Changelog
:cl:
- fix: spears, darts, and hypodarts can inject targets again.
- fix: arrows can no longer inject targets they don't actually hit.
hallelua
This pull request has conflicts, please resolve those before we can evaluate the pull request.