[PR #6116] [CLOSED] fix(dragon): send its hurt flash to guests #6660

Closed
opened 2026-11-03 06:24:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6116
Author: @doodlyyousuf
Created: 11/1/2026
Status: ❌ Closed

Base: main ← Head: fix/5999-dragon-hurt-flash


📝 Commits (2)

  • 76edbaa fix(dragon): remember the damage source its hurt flash restarts with
  • af12783 fix(dragon): broadcast its hurt flash to the guests who watch it

📊 Changes

2 files changed (+85 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/dragon.rs (+59 -1)
📝 crates/horizon-client/src/game/lan.rs (+26 -0)

📄 Description

🤖 Opened by doodlyyousuf's AI agent (opencode, GLM 5.2), not by doodlyyousuf personally.

The dragon is drawn from its own state (Dragon), not from self.mobs, so the per-mob hurt loop
in lan_flush_effects that sends DamageEvent never covered it: a guest watched the dragon take
damage with no red flash. This is reachable in single player too, because the default server-thread
path is exactly that client-of-a-server path.

  • Dragon keeps hurt_source, the LivingEntity.lastHurtSource the flash restarts with. It is set
    in hurt_part only when the hit actually restarted hurt_time, so a hit the cooldown absorbs, a
    fire hit the part refuses, a perched dragon's arrow and a dying dragon's hit all leave it alone.
  • lan_flush_effects compares the dragon's hurt_time with the last value sent for that dimension
    and names the source's damage type in a DamageEvent, the way
    ServerLevel.broadcastDamageEvent runs wherever the hit landed. LanHost::dragon_hurt holds the
    per-dimension last value, cleared when the last guest leaves alongside mob_state.
  • The client already handles it: C::DamageEvent falls through to remote_dragon_hurt, which sets
    hurt_time = 10, and dragon_geometry passes overlay = 1 (the hurt red) while it is positive.

New test a_hit_that_lands_records_the_source_the_clients_are_told covers the recording rules.
dragon::tests passes (12). pr_ready --quick reports the pre-existing title::tests failures that
also fail on main, and clippy tripping on pre-existing nonminimal_bool sites under the local
Rust 1.95 (CI's stable is 1.99); neither is in this branch's files.

Fixes #5999

🤖 Generated with opencode


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6116 **Author:** [@doodlyyousuf](https://github.com/doodlyyousuf) **Created:** 11/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/5999-dragon-hurt-flash` --- ### 📝 Commits (2) - [`76edbaa`](https://github.com/horizon-rust/horizon/commit/76edbaa3667dfae089559f12359c04fee1ab82da) fix(dragon): remember the damage source its hurt flash restarts with - [`af12783`](https://github.com/horizon-rust/horizon/commit/af127839e5f21660dfc0ae99489a63b29102ab75) fix(dragon): broadcast its hurt flash to the guests who watch it ### 📊 Changes **2 files changed** (+85 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/dragon.rs` (+59 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+26 -0) </details> ### 📄 Description > 🤖 Opened by doodlyyousuf's AI agent (opencode, GLM 5.2), not by doodlyyousuf personally. The dragon is drawn from its own state (`Dragon`), not from `self.mobs`, so the per-mob hurt loop in `lan_flush_effects` that sends `DamageEvent` never covered it: a guest watched the dragon take damage with no red flash. This is reachable in single player too, because the default server-thread path is exactly that client-of-a-server path. - `Dragon` keeps `hurt_source`, the `LivingEntity.lastHurtSource` the flash restarts with. It is set in `hurt_part` only when the hit actually restarted `hurt_time`, so a hit the cooldown absorbs, a fire hit the part refuses, a perched dragon's arrow and a dying dragon's hit all leave it alone. - `lan_flush_effects` compares the dragon's `hurt_time` with the last value sent for that dimension and names the source's damage type in a `DamageEvent`, the way `ServerLevel.broadcastDamageEvent` runs wherever the hit landed. `LanHost::dragon_hurt` holds the per-dimension last value, cleared when the last guest leaves alongside `mob_state`. - The client already handles it: `C::DamageEvent` falls through to `remote_dragon_hurt`, which sets `hurt_time = 10`, and `dragon_geometry` passes `overlay = 1` (the hurt red) while it is positive. New test `a_hit_that_lands_records_the_source_the_clients_are_told` covers the recording rules. `dragon::tests` passes (12). `pr_ready --quick` reports the pre-existing `title::tests` failures that also fail on `main`, and clippy tripping on pre-existing `nonminimal_bool` sites under the local Rust 1.95 (CI's stable is 1.99); neither is in this branch's files. Fixes #5999 🤖 Generated with [opencode](https://opencode.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:24:31 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6660
No description provided.