[PR #6118] [MERGED] Arrows redirect a wind charge along the shooter's look and bounce off it (part of #4350) #6664

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6118
Author: @Joansitoh
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/arrow-deflect-wind-charge


📝 Commits (2)

  • f97f250 Arrows strike wind charges and turn them along the shooter's look
  • f25c0dd Arrows bounce off a wind charge instead of vanishing

📊 Changes

2 files changed (+93 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+29 -3)
➕ tools/test_arrow_wind_charge_parity.py (+64 -0)

📄 Description

🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally.

Part of #4350 (only the "player-shot arrow hits wind charge" example; the rest of the issue stays open).

What

A wind charge is pickable (Projectile.isPickable, EntityTypeTags.REDIRECTABLE_PROJECTILE), so an arrow can strike it:

  • Projectile.onHit → onRedirectProjectile: the charge turns along the shooter's look (AIM_DEFLECT) and gets acceleration power 0.1 (AbstractHurtingProjectile.onDeflection). Until now only ender pearls did this.
  • AbstractArrow.onHitEntity: the charge can't be hurt, so the arrow takes deflect(REVERSE, 0.2) and falls (discarded only if its speed² < 1e-7), instead of vanishing.

Harness

tools/test_arrow_wind_charge_parity.py (arrow_wind_charge): a vanilla dedicated server vs Horizon's, a real crossbow arrow fired straight up at a still wind charge by a vanilla-protocol client. It compares that the charge ended up where a redirected, accelerating one flies and that the arrow is still in the world a second later. Checked to fail without the second commit (vanilla keeps the arrow, Horizon dropped it) and to pass with it.

Not covered (kept out of this PR)

  • Wind charge pick radius: vanilla inflates its box by getPickRadius() = 1.0; Horizon uses the plain box, as the existing pearl path does.
  • Tridents are not in the harness (they already bounce through trident_bounce); noDeflectTicks not checked.
  • The other items of #4350 (client-side arrow projection, fluids, wobble).

Checks

tools/pr_ready.py --quick --base upstream/main: Public tree ✅, Python tests ✅ 584, rustfmt ✅, clippy ✅ (all -D warnings), doc tests ✅, arrow_wind_charge harness ✅ (run locally).
horizon-client tests: 1188 passed, 3 failed on upstream/main too (verified with this PR's creatures.rs swapped for upstream's): entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation and game::tnt::tests::{a_soul_sand_bubble_column_lifts_primed_tnt, primed_tnt_follows_water_currents_after_moving}. Not touched by this diff.

Suggested label: none (fix).

🤖 Generated with Claude Code


🔄 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/6118 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/arrow-deflect-wind-charge` --- ### 📝 Commits (2) - [`f97f250`](https://github.com/horizon-rust/horizon/commit/f97f250f7ee1eee14a505113c58e338d6fb42444) Arrows strike wind charges and turn them along the shooter's look - [`f25c0dd`](https://github.com/horizon-rust/horizon/commit/f25c0dd45a25b938286693dd55ee4f018ee64fee) Arrows bounce off a wind charge instead of vanishing ### 📊 Changes **2 files changed** (+93 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+29 -3) ➕ `tools/test_arrow_wind_charge_parity.py` (+64 -0) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. Part of #4350 (only the "player-shot arrow hits wind charge" example; the rest of the issue stays open). ## What A wind charge is pickable (`Projectile.isPickable`, `EntityTypeTags.REDIRECTABLE_PROJECTILE`), so an arrow can strike it: - `Projectile.onHit` → `onRedirectProjectile`: the charge turns along the **shooter's look** (`AIM_DEFLECT`) and gets acceleration power 0.1 (`AbstractHurtingProjectile.onDeflection`). Until now only ender pearls did this. - `AbstractArrow.onHitEntity`: the charge can't be hurt, so the arrow takes `deflect(REVERSE, 0.2)` and falls (discarded only if its speed² < 1e-7), instead of vanishing. ## Harness `tools/test_arrow_wind_charge_parity.py` (`arrow_wind_charge`): a vanilla dedicated server vs Horizon's, a real crossbow arrow fired straight up at a still wind charge by a vanilla-protocol client. It compares that the charge ended up where a redirected, accelerating one flies and that the arrow is still in the world a second later. Checked to fail without the second commit (vanilla keeps the arrow, Horizon dropped it) and to pass with it. ## Not covered (kept out of this PR) - Wind charge pick radius: vanilla inflates its box by `getPickRadius()` = 1.0; Horizon uses the plain box, as the existing pearl path does. - Tridents are not in the harness (they already bounce through `trident_bounce`); `noDeflectTicks` not checked. - The other items of #4350 (client-side arrow projection, fluids, wobble). ## Checks `tools/pr_ready.py --quick --base upstream/main`: Public tree ✅, Python tests ✅ 584, rustfmt ✅, clippy ✅ (all `-D warnings`), doc tests ✅, `arrow_wind_charge` harness ✅ (run locally). `horizon-client` tests: 1188 passed, **3 failed on upstream/main too** (verified with this PR's `creatures.rs` swapped for upstream's): `entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation` and `game::tnt::tests::{a_soul_sand_bubble_column_lifts_primed_tnt, primed_tnt_follows_water_currents_after_moving}`. Not touched by this diff. Suggested label: none (fix). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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:35 +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#6664
No description provided.