[PR #1464] [MERGED] A server's players drop their inventory on death unless keep_inventory is on #3540

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1464
Author: @ludovic111
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @ludovic111

Base: main ← Head: fix/st-keep-inventory


📝 Commits (2)

  • b8e729b Totems save a server's players: the guest's turn uses it up, and entity event 35 reaches every client
  • de358cd A server's players drop their inventory on death unless keep_inventory is on

📊 Changes

6 files changed (+239 additions, -36 deletions)

View changed files

📝 crates/horizon-client/src/audio.rs (+7 -0)
📝 crates/horizon-client/src/game.rs (+26 -16)
📝 crates/horizon-client/src/game/lan_actions.rs (+19 -0)
📝 crates/horizon-client/src/game/remote.rs (+3 -0)
📝 crates/horizon-client/src/game/totem.rs (+79 -20)
📝 tools/lan_e2e.py (+105 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #1284.

What

A server's players now drop their inventory when they die, unless keep_inventory is on. This covers LAN guests and the server-thread host. Before this, a guest kept everything whatever the rule said.

Why

Only the window's in-frame death dropped anything. The guest death path in tick_guests dropped no items, and on the server thread the window's player is a guest.

How

The drop moves into one function, Game::drop_inventory, used by both deaths. It follows vanilla's Player.dropEquipment:

  1. Do nothing when keepInventory is on.
  2. Remove Curse of Vanishing items (destroyVanishingCursedItems).
  3. Throw every stack with Inventory.dropAll's random throw: strength × 0.5, a random angle, vy 0.2, pickup delay 40.

The order is the main inventory, then armour, then the off hand. A guest's turn (as_guest) does the drop from the guest's eyes, before the experience orbs. Spectators drop nothing, as in ServerPlayer.die.

Evidence

lan_e2e --check keepinv gives the player 7 diamonds and an iron helmet and kills them, once with keep_inventory false and once with it true. The check counts the item entities near the death point and what the server says the player still holds (clear @s X 0).

keep_inventory false in-frame, before in-frame, after --server-thread, before --server-thread, after
host drops diamond 7, iron_helmet 1 same drops nothing, keeps all drops both
guest drops nothing, keeps all drops both drops nothing, keeps all drops both

With keep_inventory true, nobody drops anything and everyone keeps everything, in both modes, before and after.

How tested

Self-check on the top of the stack (fix/st-books, which contains this PR), Mac mini M4 Pro:

  • cargo fmt --all --check: OK
  • cargo clippy --workspace --all-targets -- -D warnings: OK
  • cargo test -p horizon-protocol: 71 passed. cargo test -p horizon-client --lib: 1061 passed (26 ignored). --bins: 98 + 18 passed.
  • python3 tools/parity.py --changed origin/main: 106 harnesses, 106 passed, 0 failed (23 min).
  • tools/lan_e2e.py, the new checks in both modes (in-frame, then --server-thread), host and guest; the existing sign and lectern checks still pass. Before = origin/main b65e082fd built with the same profile, after = this stack.

Stack

Four small PRs, one fix each, each on top of the previous one (the new lan_e2e checks share one block at the end of the file). Merge in order: #1463 (totem) → #1464 (keep_inventory) → #1465 (signs) → #1466 (books). The change for each PR is its top commit. #1475 (Elytra) and #1476 (shields, tridents, crossbows, spyglasses) continue the stack after #1466.

They leave alone the lines that #1419, #1420 and #1423–#1427 change in tools/lan_e2e.py. The new checks go in a block before if __name__ (CHECKS += [...], CHECK_FNS.update(...)). git merge-tree is clean against each of #1423–#1427. #1419 and #1420 already conflict with main on their own.

Needs Ludovic

A review and a merge, in stack order. Nothing else.

🤖 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/1464 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/st-keep-inventory` --- ### 📝 Commits (2) - [`b8e729b`](https://github.com/horizon-rust/horizon/commit/b8e729b950284890ec79d11e4bb448e3a3e4782c) Totems save a server's players: the guest's turn uses it up, and entity event 35 reaches every client - [`de358cd`](https://github.com/horizon-rust/horizon/commit/de358cd72127156cd9c27ecd662ee73b86adb113) A server's players drop their inventory on death unless keep_inventory is on ### 📊 Changes **6 files changed** (+239 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/audio.rs` (+7 -0) 📝 `crates/horizon-client/src/game.rs` (+26 -16) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+19 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+3 -0) 📝 `crates/horizon-client/src/game/totem.rs` (+79 -20) 📝 `tools/lan_e2e.py` (+105 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #1284. ## What A server's players now drop their inventory when they die, unless `keep_inventory` is on. This covers LAN guests and the server-thread host. Before this, a guest kept everything whatever the rule said. ## Why Only the window's in-frame death dropped anything. The guest death path in `tick_guests` dropped no items, and on the server thread the window's player is a guest. ## How The drop moves into one function, `Game::drop_inventory`, used by both deaths. It follows vanilla's `Player.dropEquipment`: 1. Do nothing when `keepInventory` is on. 2. Remove Curse of Vanishing items (`destroyVanishingCursedItems`). 3. Throw every stack with `Inventory.dropAll`'s random throw: strength × 0.5, a random angle, vy 0.2, pickup delay 40. The order is the main inventory, then armour, then the off hand. A guest's turn (`as_guest`) does the drop from the guest's eyes, before the experience orbs. Spectators drop nothing, as in `ServerPlayer.die`. ## Evidence `lan_e2e --check keepinv` gives the player 7 diamonds and an iron helmet and kills them, once with `keep_inventory` false and once with it true. The check counts the item entities near the death point and what the server says the player still holds (`clear @s X 0`). | keep_inventory false | in-frame, before | in-frame, after | `--server-thread`, before | `--server-thread`, after | |---|---|---|---|---| | host | drops diamond 7, iron_helmet 1 | same | **drops nothing, keeps all** | drops both | | guest | **drops nothing, keeps all** | drops both | **drops nothing, keeps all** | drops both | With `keep_inventory` true, nobody drops anything and everyone keeps everything, in both modes, before and after. ## How tested Self-check on the top of the stack (fix/st-books, which contains this PR), Mac mini M4 Pro: - `cargo fmt --all --check`: OK - `cargo clippy --workspace --all-targets -- -D warnings`: OK - `cargo test -p horizon-protocol`: 71 passed. `cargo test -p horizon-client --lib`: 1061 passed (26 ignored). `--bins`: 98 + 18 passed. - `python3 tools/parity.py --changed origin/main`: 106 harnesses, 106 passed, 0 failed (23 min). - `tools/lan_e2e.py`, the new checks in both modes (in-frame, then `--server-thread`), host and guest; the existing `sign` and `lectern` checks still pass. Before = origin/main b65e082fd built with the same profile, after = this stack. ## Stack Four small PRs, one fix each, each on top of the previous one (the new lan_e2e checks share one block at the end of the file). Merge in order: #1463 (totem) → #1464 (keep_inventory) → #1465 (signs) → #1466 (books). The change for each PR is its top commit. #1475 (Elytra) and #1476 (shields, tridents, crossbows, spyglasses) continue the stack after #1466. They leave alone the lines that #1419, #1420 and #1423–#1427 change in `tools/lan_e2e.py`. The new checks go in a block before `if __name__` (`CHECKS += [...]`, `CHECK_FNS.update(...)`). `git merge-tree` is clean against each of #1423–#1427. #1419 and #1420 already conflict with main on their own. ## Needs Ludovic A review and a merge, in stack order. Nothing else. 🤖 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 04:10:17 +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#3540
No description provided.