[PR #2452] [MERGED] Name the potion, cloud or thrower in magic death messages #4329

Closed
opened 2026-11-03 04:16:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2452
Author: @kacpherek
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/magic-death-message


📝 Commits (4)

  • f312aae Name the potion, cloud or thrower in magic death messages
  • f4a235e Record a witch potion source only when it deals damage
  • 3f0e708 Death messages: no fallback for a message with no entity behind it
  • e338690 Merge main into this branch (resolves the conflict with main)

📊 Changes

7 files changed (+162 additions, -30 deletions)

View changed files

📝 crates/horizon-client/src/game/combat.rs (+32 -0)
📝 crates/horizon-client/src/game/commands/world_cmds.rs (+9 -0)
📝 crates/horizon-client/src/game/creatures.rs (+62 -21)
📝 crates/horizon-client/src/game/dispenser.rs (+1 -1)
📝 crates/horizon-client/src/game/dragon.rs (+4 -1)
📝 crates/horizon-client/src/game/fangs.rs (+12 -1)
📝 crates/horizon-client/src/game/potions.rs (+42 -6)

📄 Description

What and why

A player who died to indirect magic (a splash potion of harming, an evoker's fangs, a dragon breath cloud, /damage ... indirect_magic by ...) saw the raw template "%1$s was killed by %2$s using magic" on the death screen and in chat. The death message was built from the combat tracker, and those damage sources never recorded an entity to name, so the message was translated with the victim only and the whole translation failed.

Fixed by recording what vanilla's DamageSource has for each source:

  • Combat entries can now carry a direct entity's display name (note_direct_entity) for damage no entity caused. combat_death_message_for names the causing entity, else that direct entity, as getLocalizedDeathMessage does. It is not kill credit.
  • ThrownPotion keeps its owner's display name. A player's thrown potion (host or guest) lands as indirect_magic naming the thrower; a dispenser's names "Splash Potion" or, for a lingering one, "Area Effect Cloud". The in-place instant damage used plain magic, which vanilla only uses when there is no source.
  • Witch potions (projectile_hit) name the witch, or "Splash Potion" when the witch is gone.
  • Evoker fangs named whichever mob stood nearest to the fangs. They now name the evoker, and deal plain magic once it is gone, as EvokerFangs.dealDamageTo does.
  • Dragon breath names the dragon, or "Area Effect Cloud" once it is dead.
  • /damage <player> <n> <type> by <entity> records by as the causing entity.
  • Safety net: a death key that needs a second argument and has none falls back to death.attack.magic (for indirectMagic) or death.attack.generic, never the raw template.

Guests go through the same code: their tracker is swapped in while they act, and guest_die builds the message from it, so the text the server sends (and the death screen shows) carries both arguments.

Vanilla reference

  • DamageSource.getLocalizedDeathMessage
  • DamageSources.indirectMagic
  • HealOrHarmMobEffect.applyInstantaneousEffect
  • AbstractThrownPotion, AreaEffectCloud
  • EvokerFangs.dealDamageTo
  • Guardian beam: already named the guardian (nearest mob to its own position), left as is.

Self-check

cargo check -p horizon-client passes.


🔄 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/2452 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/magic-death-message` --- ### 📝 Commits (4) - [`f312aae`](https://github.com/horizon-rust/horizon/commit/f312aae7dbf6358093ce27906311c4416446c2e1) Name the potion, cloud or thrower in magic death messages - [`f4a235e`](https://github.com/horizon-rust/horizon/commit/f4a235e02792a38530ea9058bc4bbbde2ef771e2) Record a witch potion source only when it deals damage - [`3f0e708`](https://github.com/horizon-rust/horizon/commit/3f0e70882c8f6be6aa73c8700e70d9eb98457acc) Death messages: no fallback for a message with no entity behind it - [`e338690`](https://github.com/horizon-rust/horizon/commit/e338690bf9b1f6340570c2679d1a25b4983303e3) Merge main into this branch (resolves the conflict with main) ### 📊 Changes **7 files changed** (+162 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/combat.rs` (+32 -0) 📝 `crates/horizon-client/src/game/commands/world_cmds.rs` (+9 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+62 -21) 📝 `crates/horizon-client/src/game/dispenser.rs` (+1 -1) 📝 `crates/horizon-client/src/game/dragon.rs` (+4 -1) 📝 `crates/horizon-client/src/game/fangs.rs` (+12 -1) 📝 `crates/horizon-client/src/game/potions.rs` (+42 -6) </details> ### 📄 Description ## What and why A player who died to indirect magic (a splash potion of harming, an evoker's fangs, a dragon breath cloud, `/damage ... indirect_magic by ...`) saw the raw template "%1$s was killed by %2$s using magic" on the death screen and in chat. The death message was built from the combat tracker, and those damage sources never recorded an entity to name, so the message was translated with the victim only and the whole translation failed. Fixed by recording what vanilla's `DamageSource` has for each source: - Combat entries can now carry a direct entity's display name (`note_direct_entity`) for damage no entity caused. `combat_death_message_for` names the causing entity, else that direct entity, as `getLocalizedDeathMessage` does. It is not kill credit. - `ThrownPotion` keeps its owner's display name. A player's thrown potion (host or guest) lands as `indirect_magic` naming the thrower; a dispenser's names "Splash Potion" or, for a lingering one, "Area Effect Cloud". The in-place instant damage used plain `magic`, which vanilla only uses when there is no source. - Witch potions (`projectile_hit`) name the witch, or "Splash Potion" when the witch is gone. - Evoker fangs named whichever mob stood nearest to the fangs. They now name the evoker, and deal plain `magic` once it is gone, as `EvokerFangs.dealDamageTo` does. - Dragon breath names the dragon, or "Area Effect Cloud" once it is dead. - `/damage <player> <n> <type> by <entity>` records `by` as the causing entity. - Safety net: a death key that needs a second argument and has none falls back to `death.attack.magic` (for `indirectMagic`) or `death.attack.generic`, never the raw template. Guests go through the same code: their tracker is swapped in while they act, and `guest_die` builds the message from it, so the text the server sends (and the death screen shows) carries both arguments. ## Vanilla reference - `DamageSource.getLocalizedDeathMessage` - `DamageSources.indirectMagic` - `HealOrHarmMobEffect.applyInstantaneousEffect` - `AbstractThrownPotion`, `AreaEffectCloud` - `EvokerFangs.dealDamageTo` - `Guardian` beam: already named the guardian (nearest mob to its own position), left as is. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:16:22 +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#4329
No description provided.