feat(blood): add blood splatter overlay on damage - #180
Open
TheMeinerLP wants to merge 5 commits into
Open
Conversation
Cygnus needed a way to tell a survivor they were just hit and from which side, separate from the tunnel vision's read on how they are doing overall. The splatter rides the shared screen overlay's BLOOD layer, fades over twelve 100 ms frames (1.2 seconds total), and BloodDirection.between resolves the hit side from the victim's own facing rather than world coordinates, so a hit from the east reads differently depending on which way the player is looking.
SlenderBarHelper.applyDamage sets a target's health directly, which never raises Minestom's own EntityDamageEvent, so nothing reacting to a hit - the blood splatter above all - would otherwise hear about it. This adds PlayerDamagedEvent, carrying the victim, the source position and the amount, and dispatches it right after the health is lowered. The source position is what lets the splatter be aimed at the side the hit came from.
Waiting to get hit is a slow way to judge a splatter drawing. /blood throws one from a random side, and /blood front|right|back|left asks for a specific one, so the four directions and their variants can be checked without needing a slender in the game.
Builds the shared screen overlay and the blood splatter service, registers /blood, and hooks the service's listener behind the same OverlayProperties guard the other overlay effects use, since the splatter textures only exist when a resource pack that ships them is configured.
Records why the splatter shares the screen overlay's head slot with the tunnel vision instead of pre-rendering every combination, how the direction is worked out from the victim's facing, and the frame/texture layout the cygnus-pack generator relies on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a blood splatter effect: when a survivor is hit, blood is thrown across the screen from the
side the hit came from and fades out over 1.2 seconds.
SlenderBarHelper.applyDamageby setting health directly, whichnever raises Minestom's own
EntityDamageEvent.PlayerDamagedEventfills that gap: it isdispatched right after the health is lowered and carries the victim, the source position, and the
amount, so listeners have something to react to.
BloodSplatterServicelistens forPlayerDamagedEventand throws a splatter on the shared screenoverlay's
BLOODlayer, stepping through twelve 100 ms frames (1.2 seconds total) before clearingit. A fresh hit replaces a still-fading splatter and restarts the sequence.
BloodDirection.betweenpicks one of four sides (front/right/back/left) from the victim's ownfacing, not world coordinates - a hit from the east lands on the left for a player looking south
and on the right for one looking north.
/blood [front|right|back|left]throws a splatter on demand (random side if none given), so thedrawings can be judged without waiting to get hit.
cygnus-pack; this PR only wires the overlaylogic and is inert wherever a resource pack that provides them isn't configured.
Notes for reviewers
Cygnus.javawill also be touched by the siblingtunnel vision and gaze PRs cut from the same working branch - whichever of the three merges second
will need a small rebase to reconcile the constructor/listener wiring.
Test plan
./gradlew test- full suite passes, includingBloodDirectionTest,BloodSplatterServiceTest,BloodCommandTest, andSlenderBarHelperDamageTest