server/entity: fix a firework damaging players through walls - #1415
Open
schphe wants to merge 2 commits into
Open
server/entity: fix a firework damaging players through walls#1415schphe wants to merge 2 commits into
schphe wants to merge 2 commits into
Conversation
Member
|
I don't think the fix is quite right. Perform truncates the ray at the block it hits (end = hit.Position()) before it tests entities, so an entity standing between the firework and the wall still produces an EntityResult and the victim behind the wall takes damage anyway. Perform is the wrong tool here: it answers "what did this ray hit first", not "is there a block in between". Could this test block occlusion only, via TraverseBlocks/BlockIntercept? ExplosionConfig.exposure already does block-only line-of-sight for the same purpose, so there's a pattern to follow. |
schphe
force-pushed
the
fix/firework-damage-through-walls
branch
4 times, most recently
from
August 18, 2026 00:45
7961341 to
1e8aeb4
Compare
The check for a clear line between an exploding firework and a victim treats any hit as a clear line. trace.Perform reports a hit for the block it stopped at as well as for an entity, so a wall between the two satisfied it and the damage was dealt through the wall. Only a hit that is not a block counts now.
trace.Perform answers what a ray hits first, not whether a block is in between: it overwrites the block it stopped at with any entity it intercepts, so an entity standing in front of a wall let the damage through it. Traverse the blocks instead, as ExplosionConfig.exposure does. Co-Authored-By: Claude <noreply@anthropic.com>
schphe
force-pushed
the
fix/firework-damage-through-walls
branch
from
August 20, 2026 07:51
1e8aeb4 to
8f523f3
Compare
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.
What happens and why
The check for a clear line between an exploding firework and a victim treats
any hit as a clear line. trace.Perform reports a hit for the block it stopped
at as well as for an entity, so a wall between the two satisfied it and the
damage was dealt through the wall. Only a hit that is not a block counts now.
Verification
Reproduced in process: a firework exploding on the far side of a wall damages a player through it.
trace.Performreports a hit for the block it stopped at (server/block/cube/trace/result.go:32) as well as for an entity, so the guard that was meant to require a clear line accepted the wall as one.No unit test: the fix is a type check on a result the surrounding code already has, and reaching it needs a firework entity, a victim and a wall in a live world.