[PR #2464] [MERGED] Give /damage on a player its source, knockback and kill credit #4341

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

📋 Pull Request Information

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

Base: main ← Head: fix/damage-command-player-source


📝 Commits (2)

  • 27b81d9 Give /damage on a player its source, knockback and kill credit
  • f1f587e Merge main into this branch (resolves the conflict with main)

📊 Changes

2 files changed (+39 additions, -33 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/world_cmds.rs (+19 -18)
📝 crates/horizon-client/src/game/creatures.rs (+20 -15)

📄 Description

What and why

/damage on a player ignored by, from and at: the hit had no source, so no knockback and no credit to the mob that was named. It now goes through the same hit as a mob attack:

  • the source position (at <location>, or the position of the by entity) sets the knockback direction, and shields facing it can block;
  • a mob named by by (or by from <cause>, which wins when given) is credited with the hit, so the death message names it and thorns answer;
  • with no source position the knockback goes in a random direction, as vanilla does.

The mob branch now also takes from <cause> as the attacker. The mob-attack code in creatures.rs is split so /damage can pass the attacker it knows instead of guessing the nearest mob.

Damage to other LAN guests by /damage is not changed here.

Vanilla reference

DamageCommand (DamageSource with direct and causing entity or position), LivingEntity.hurtServer and dealDefaultKnockback.

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/2464 **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/damage-command-player-source` --- ### 📝 Commits (2) - [`27b81d9`](https://github.com/horizon-rust/horizon/commit/27b81d9a8f5390a2992385ba67ecc0902bea742a) Give /damage on a player its source, knockback and kill credit - [`f1f587e`](https://github.com/horizon-rust/horizon/commit/f1f587e7c2aab6337cd2cb5c4897b14c926264e4) Merge main into this branch (resolves the conflict with main) ### 📊 Changes **2 files changed** (+39 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/world_cmds.rs` (+19 -18) 📝 `crates/horizon-client/src/game/creatures.rs` (+20 -15) </details> ### 📄 Description ## What and why `/damage` on a player ignored `by`, `from` and `at`: the hit had no source, so no knockback and no credit to the mob that was named. It now goes through the same hit as a mob attack: - the source position (`at <location>`, or the position of the `by` entity) sets the knockback direction, and shields facing it can block; - a mob named by `by` (or by `from <cause>`, which wins when given) is credited with the hit, so the death message names it and thorns answer; - with no source position the knockback goes in a random direction, as vanilla does. The mob branch now also takes `from <cause>` as the attacker. The mob-attack code in `creatures.rs` is split so `/damage` can pass the attacker it knows instead of guessing the nearest mob. Damage to other LAN guests by `/damage` is not changed here. ## Vanilla reference `DamageCommand` (`DamageSource` with direct and causing entity or position), `LivingEntity.hurtServer` and `dealDefaultKnockback`. ## 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:28 +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#4341
No description provided.