[PR #5123] [MERGED] lan: keep moves queued behind an attack or interaction for the next tick #6087

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5123
Author: @mulareal
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix-attack-queued-moves-4524


📝 Commits (1)

  • 0b179e1 lan: keep moves queued behind an attack or interaction for the next tick

📊 Changes

2 files changed (+64 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/lan/hub.rs (+25 -4)
📝 crates/horizon-client/tests/lan_bot.rs (+39 -0)

📄 Description

🤖 Opened by mulareal's AI agent (Antigravity, Gemini), not by mulareal personally.

What

A falling attack that arrives in the same server tick as a trailing landing move now deals a critical hit on LAN and dedicated servers instead of regular ground damage.

Fixes #4524

Why

  • ServerGamePacketListenerImpl handles packets in arrival order: when ServerboundAttackPacket arrives before a ServerboundMovePlayerPacket in the same tick, handleAttack runs Player.attack before that move lands the player on the ground.
  • Hub::process_inbox applied all queued moves in its pass (Hub::position_change setting g.on_ground = flags & 1 != 0) while deferring S::Attack and S::Interact to HostEvent::Packet, which the game ran afterward. When a landing move followed an attack in the same tick's inbox, enter_guest copied g.on_ground = true into the guest's body before guest_attack, so Game::critical_attack saw the player on the ground.
  • Hub::move_queued also checked only S::MovePlayerPos and S::MovePlayerPosRot, omitting S::MovePlayerRot and S::MovePlayerStatus, which likewise update g.on_ground.

Fix

  • Include S::MovePlayerRot and S::MovePlayerStatus in Hub::move_queued (crates/horizon-client/src/lan/hub.rs).
  • Stop Hub::process_inbox after S::Attack or S::Interact when self.move_queued(i) is true, as S::PlayerAction and S::UseItemOn already do.
  • Add a_move_behind_an_attack_and_its_swing_waits_for_the_next_tick in crates/horizon-client/tests/lan_bot.rs.

Checked

  • cargo test -p horizon-client --lib --bins --tests -j 2 (1358 passed, including a_move_behind_an_attack_and_its_swing_waits_for_the_next_tick).
  • In-game check on a survival world with a NoAI iron golem and netherite sword: falling attacks right before landing deal critical hits (12 damage, crit particles and sound).
Check Result
Scope ✅ 2 files, +64 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 484 passed
rustfmt ✅
clippy (horizon-client) ✅
tests: horizon-client ✅ 1358 passed
doc tests ✅ 0 passed
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

🤖 Generated with Antigravity


🔄 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/5123 **Author:** [@mulareal](https://github.com/mulareal) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix-attack-queued-moves-4524` --- ### 📝 Commits (1) - [`0b179e1`](https://github.com/horizon-rust/horizon/commit/0b179e13dcb6fed2b9920668a68cb45eca5945d8) lan: keep moves queued behind an attack or interaction for the next tick ### 📊 Changes **2 files changed** (+64 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/hub.rs` (+25 -4) 📝 `crates/horizon-client/tests/lan_bot.rs` (+39 -0) </details> ### 📄 Description > 🤖 Opened by mulareal's AI agent (Antigravity, Gemini), not by mulareal personally. ## What A falling attack that arrives in the same server tick as a trailing landing move now deals a critical hit on LAN and dedicated servers instead of regular ground damage. Fixes #4524 ## Why - `ServerGamePacketListenerImpl` handles packets in arrival order: when `ServerboundAttackPacket` arrives before a `ServerboundMovePlayerPacket` in the same tick, `handleAttack` runs `Player.attack` before that move lands the player on the ground. - `Hub::process_inbox` applied all queued moves in its pass (`Hub::position_change` setting `g.on_ground = flags & 1 != 0`) while deferring `S::Attack` and `S::Interact` to `HostEvent::Packet`, which the game ran afterward. When a landing move followed an attack in the same tick's inbox, `enter_guest` copied `g.on_ground = true` into the guest's body before `guest_attack`, so `Game::critical_attack` saw the player on the ground. - `Hub::move_queued` also checked only `S::MovePlayerPos` and `S::MovePlayerPosRot`, omitting `S::MovePlayerRot` and `S::MovePlayerStatus`, which likewise update `g.on_ground`. ## Fix - Include `S::MovePlayerRot` and `S::MovePlayerStatus` in `Hub::move_queued` (`crates/horizon-client/src/lan/hub.rs`). - Stop `Hub::process_inbox` after `S::Attack` or `S::Interact` when `self.move_queued(i)` is true, as `S::PlayerAction` and `S::UseItemOn` already do. - Add `a_move_behind_an_attack_and_its_swing_waits_for_the_next_tick` in `crates/horizon-client/tests/lan_bot.rs`. ## Checked - `cargo test -p horizon-client --lib --bins --tests -j 2` (1358 passed, including `a_move_behind_an_attack_and_its_swing_waits_for_the_next_tick`). - In-game check on a survival world with a `NoAI` iron golem and netherite sword: falling attacks right before landing deal critical hits (12 damage, crit particles and sound). | Check | Result | |---|---| | Scope | ✅ 2 files, +64 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 484 passed | | rustfmt | ✅ | | clippy (`horizon-client`) | ✅ | | tests: horizon-client | ✅ 1358 passed | | doc tests | ✅ 0 passed | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | 🤖 Generated with [Antigravity](https://antigravity.google) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:11:33 +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#6087
No description provided.