Skip to content

feat(blood): add blood splatter overlay on damage - #180

Open
TheMeinerLP wants to merge 5 commits into
refactor/overlay-foundationfrom
feat/blood-splatter
Open

feat(blood): add blood splatter overlay on damage#180
TheMeinerLP wants to merge 5 commits into
refactor/overlay-foundationfrom
feat/blood-splatter

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

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.

  • Cygnus applies stamina damage in SlenderBarHelper.applyDamage by setting health directly, which
    never raises Minestom's own EntityDamageEvent. PlayerDamagedEvent fills that gap: it is
    dispatched right after the health is lowered and carries the victim, the source position, and the
    amount, so listeners have something to react to.
  • BloodSplatterService listens for PlayerDamagedEvent and throws a splatter on the shared screen
    overlay's BLOOD layer, stepping through twelve 100 ms frames (1.2 seconds total) before clearing
    it. A fresh hit replaces a still-fading splatter and restarts the sequence.
  • BloodDirection.between picks one of four sides (front/right/back/left) from the victim's own
    facing
    , 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 the
    drawings can be judged without waiting to get hit.
  • The splatter textures themselves ship separately in cygnus-pack; this PR only wires the overlay
    logic and is inert wherever a resource pack that provides them isn't configured.

Notes for reviewers

  • Based on refactor: extract shared overlay foundation #177 (shared overlay foundation). Cygnus.java will also be touched by the sibling
    tunnel 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, including BloodDirectionTest,
    BloodSplatterServiceTest, BloodCommandTest, and SlenderBarHelperDamageTest

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.
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.

1 participant