[PR #1285] [MERGED] Play with Friends on single player's server thread #3479

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

📋 Pull Request Information

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

Base: main ← Head: fix/friends-server-thread


📝 Commits (1)

  • 7f7a05c Play with Friends on single player's server thread

📊 Changes

2 files changed (+31 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game/friends.rs (+16 -8)
📝 tools/test_friends.py (+15 -3)

📄 Description

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

This is one of the items needed before #1265 can make the server thread the default again (from #1271's notes: "Play with Friends needs the world in the render thread"). It goes alongside #1280 (vehicles and lightning).

What

Single player on its server thread refused to share the world with an invite code ("open a singleplayer world first"), because the window is a client of the integrated server there. It now shares that server the same way Open to LAN publishes it:

  • friends_start publishes the server when it isn't published yet (lan_open already does this through Integrated::call).
  • The invite tunnel points at the server's port.
  • Stopping sharing unpublishes it again if sharing opened it (lan_close already handles the server thread).
  • The pause menu's Friends entry is shown, and lists the players the server lists.

With #1271 merged, its server-thread check that greys out the Friends icon can go. Whichever PR merges second should drop it; we'll do that ourselves.

How tested (Mac mini)

  • tools/test_friends.py --offscreen passes with the host on its server thread (new --server-thread flag) and in the window. Both runs cover:
    • the code alone, with chat, movement and blocks both ways;
    • the old code refused after stopping, and LAN closed again;
    • a local self-hosted relay with the short code (about 88 KB relayed);
    • "invite has ended" after stopping.
  • The test now moves the host and places its blocks with /tp, /fill and /setblock instead of the control socket's local edits. On the server thread the server has the last word, and the commands work the same in both modes.
  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings and cargo test -p horizon-client (1018 + 94 + more) all pass.
  • tools/parity.py --changed origin/main on head 7f7a05cb: 22 passed, 0 failed (the 22 harnesses that depend on the changed files).

What needs Ludovic

Nothing.

🤖 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/1285 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/friends-server-thread` --- ### 📝 Commits (1) - [`7f7a05c`](https://github.com/horizon-rust/horizon/commit/7f7a05cbd093b87093267bcb88541744d9fd8591) Play with Friends on single player's server thread ### 📊 Changes **2 files changed** (+31 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/friends.rs` (+16 -8) 📝 `tools/test_friends.py` (+15 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. This is one of the items needed before #1265 can make the server thread the default again (from #1271's notes: "Play with Friends needs the world in the render thread"). It goes alongside #1280 (vehicles and lightning). ## What Single player on its server thread refused to share the world with an invite code ("open a singleplayer world first"), because the window is a client of the integrated server there. It now shares that server the same way Open to LAN publishes it: - `friends_start` publishes the server when it isn't published yet (`lan_open` already does this through `Integrated::call`). - The invite tunnel points at the server's port. - Stopping sharing unpublishes it again if sharing opened it (`lan_close` already handles the server thread). - The pause menu's Friends entry is shown, and lists the players the server lists. With #1271 merged, its server-thread check that greys out the Friends icon can go. Whichever PR merges second should drop it; we'll do that ourselves. ## How tested (Mac mini) - `tools/test_friends.py --offscreen` passes with the host on its server thread (new `--server-thread` flag) and in the window. Both runs cover: - the code alone, with chat, movement and blocks both ways; - the old code refused after stopping, and LAN closed again; - a local self-hosted relay with the short code (about 88 KB relayed); - "invite has ended" after stopping. - The test now moves the host and places its blocks with `/tp`, `/fill` and `/setblock` instead of the control socket's local edits. On the server thread the server has the last word, and the commands work the same in both modes. - `cargo fmt --check`, `cargo clippy --workspace --all-targets -D warnings` and `cargo test -p horizon-client` (1018 + 94 + more) all pass. - `tools/parity.py --changed origin/main` on head 7f7a05cb: 22 passed, 0 failed (the 22 harnesses that depend on the changed files). ## What needs Ludovic Nothing. 🤖 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:09:49 +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#3479
No description provided.