[PR #6417] [MERGED] A player who dies with a container open closes it at death, not at respawn #6858

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

📋 Pull Request Information

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

Base: main ← Head: fix/dead-player-closes-container


📝 Commits (1)

  • c7d2b11 A player who dies with a container open closes it at death, not at respawn

📊 Changes

1 file changed (+9 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/native_menus.rs (+9 -1)

📄 Description

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

Fixes #6403

What was wrong

In vanilla AbstractContainerScreen.tick closes the container as soon as the player is no longer alive, so the server's doCloseContainer runs at death. Horizon closed a dead guest's container only in guest_respawn (lan_actions.rs), when the player pressed Respawn. Until then the chest's opener count stayed up (the lid stayed open) and tick_player_menus (native_menus.rs) kept seeing the menu as open, so PlayerContainerEvent.Close reached the mods only after the respawn.

What changes

tick_player_menus, which already walks the guests of the level each tick: a dead guest's open container is closed there (guest_container_closed for the lid, then close_container, the same calls guest_respawn makes), and the menus a dead guest has otherwise (a trade, a crafting table, a workstation, a lectern, a mount window) count as closed for the comparison, so the mods hear Close during the death screen. The respawn's own close finds nothing left to do.

Verification

Builds; cargo test -p horizon-client --lib passes (582 tests), and clippy and rustfmt are clean for the changed file (the only clippy error is the existing needless_borrow in horizon-world). Not run in game with a mod logging both hooks, which is the issue's test route (a throwaway horizon-machine-sample branch).

Not done

The trade, crafting table, station, lectern and mount windows are only counted as closed for the hook; their own state is still released at respawn as before.

🤖 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/6417 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/dead-player-closes-container` --- ### 📝 Commits (1) - [`c7d2b11`](https://github.com/horizon-rust/horizon/commit/c7d2b1199c4c71b4f85b1c5cda06453b8643d8a2) A player who dies with a container open closes it at death, not at respawn ### 📊 Changes **1 file changed** (+9 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/native_menus.rs` (+9 -1) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally. Fixes #6403 ## What was wrong In vanilla `AbstractContainerScreen.tick` closes the container as soon as the player is no longer alive, so the server's `doCloseContainer` runs at death. Horizon closed a dead guest's container only in `guest_respawn` (`lan_actions.rs`), when the player pressed Respawn. Until then the chest's opener count stayed up (the lid stayed open) and `tick_player_menus` (`native_menus.rs`) kept seeing the menu as open, so `PlayerContainerEvent.Close` reached the mods only after the respawn. ## What changes `tick_player_menus`, which already walks the guests of the level each tick: a dead guest's open container is closed there (`guest_container_closed` for the lid, then `close_container`, the same calls `guest_respawn` makes), and the menus a dead guest has otherwise (a trade, a crafting table, a workstation, a lectern, a mount window) count as closed for the comparison, so the mods hear `Close` during the death screen. The respawn's own close finds nothing left to do. ## Verification Builds; `cargo test -p horizon-client --lib` passes (582 tests), and clippy and rustfmt are clean for the changed file (the only clippy error is the existing `needless_borrow` in `horizon-world`). Not run in game with a mod logging both hooks, which is the issue's test route (a throwaway horizon-machine-sample branch). ## Not done The trade, crafting table, station, lectern and mount windows are only counted as closed for the hook; their own state is still released at respawn as before. 🤖 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:28:15 +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#6858
No description provided.