[PR #6224] [MERGED] Native mods: a registered command run from a single player's owner console #6728

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

📋 Pull Request Information

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

Base: main ← Head: mods/owner-console-native-commands


📝 Commits (1)

  • c73e087 Native mods: a registered command run from a single player's owner console

📊 Changes

3 files changed (+11 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/integrated.rs (+6 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+3 -1)
📝 docs/native-mods.md (+2 -1)

📄 Description

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

What and why

Fixes #5682 (the dedicated console half was #5815), part of #4953. A command a native mod registers with native_register_commands ran from a player's chat and the dedicated console, but not from the single player owner's console: owner_console_command (what horizon-ctl command and the MCP command tool call) sent every line to the vanilla dispatcher, which answered "Unknown or incomplete command".

Detimes claimed #5682 this morning and did the dedicated console in #5815, which left the owner console as it was; this is that remaining half. Detimes, say if you had it under way and I'll close this.

owner_console_command now offers the line to perform_native_command first, inside the owner's swap, at level 4 (the console's). A name no mod registered goes to the dispatcher as before. No new hook point and no API number: the mod hears the same native_perform_command as for the owner's chat, with the owner as player (so native_acting_player, native_player and native_feedback work, and the feedback comes back in the console's reply). The doc comment of native_perform_command and docs/native-mods.md say so (the latter no longer says the owner's console is not covered).

Not changed: native_player_command (any command a player typed) is not fired for the console, since nobody typed it in chat; say if it should be.

Kind

  • fix (mod authors see their commands work from the agent console)

Vanilla reference

Commands.performCommand runs a console line and a player's with their own command source; here the owner's source at level 4, as as_console already sets.

Other projects' code

None.

Proof in the real game

Server thread (horizon-ctl launch --world L --creative --offscreen), engine from this branch with throwaway eprintln!s and a registered lanecmd (level 4) in the hook bodies (not in this PR):

ctl command 'lanecmd extra'  -> {"chat":["lanecmd answered"],"ok":true}
ctl chat '/lanecmd'          -> (chat shows "lanecmd answered")
ctl command 'list'           -> {"chat":["There are 1 of a max of 8 players online: Player29448"],"ok":true}  (vanilla, as before)
TESTHOOK player_command Player29448 perm=4 cmd="lanecmd extra"
TESTHOOK player_command Player29448 perm=4 cmd="lanecmd"

Dedicated server (regression check of #5815's path, which this does not touch): lanecmd on the console printed TESTHOOK console_command "lanecmd", list still answered.

Not run: the same on main without the change (the issue reports the "Unknown" answer); a real mod bundle built with horizon-mixins (the probe stands in for it).

Self-check

pr_ready (tools/pr_ready.py --quick --base hr/main on cachyos-x8664, against hr/main at 9f683428a, 6 min 12 s)

Check Result
Scope ✅ 3 files, +11 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 586 passed (1 min 16 s)
rustfmt ✅ (6 s)
clippy ✅ (2 min 23 s)
tests: horizon-client ✅ 1803 passed (2 min 23 s)
doc tests ✅ 0 passed (4 s)
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 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/6224 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `mods/owner-console-native-commands` --- ### 📝 Commits (1) - [`c73e087`](https://github.com/horizon-rust/horizon/commit/c73e087d70496da8b201dc9b50e58eae2376dc77) Native mods: a registered command run from a single player's owner console ### 📊 Changes **3 files changed** (+11 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/integrated.rs` (+6 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+3 -1) 📝 `docs/native-mods.md` (+2 -1) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. ## What and why Fixes #5682 (the dedicated console half was #5815), part of #4953. A command a native mod registers with `native_register_commands` ran from a player's chat and the dedicated console, but not from the single player owner's console: `owner_console_command` (what `horizon-ctl command` and the MCP `command` tool call) sent every line to the vanilla dispatcher, which answered "Unknown or incomplete command". Detimes claimed #5682 this morning and did the dedicated console in #5815, which left the owner console as it was; this is that remaining half. Detimes, say if you had it under way and I'll close this. `owner_console_command` now offers the line to `perform_native_command` first, inside the owner's swap, at level 4 (the console's). A name no mod registered goes to the dispatcher as before. No new hook point and no API number: the mod hears the same `native_perform_command` as for the owner's chat, with the owner as `player` (so `native_acting_player`, `native_player` and `native_feedback` work, and the feedback comes back in the console's reply). The doc comment of `native_perform_command` and docs/native-mods.md say so (the latter no longer says the owner's console is not covered). Not changed: `native_player_command` (any command a player typed) is not fired for the console, since nobody typed it in chat; say if it should be. ## Kind - [x] fix (mod authors see their commands work from the agent console) ## Vanilla reference `Commands.performCommand` runs a console line and a player's with their own command source; here the owner's source at level 4, as `as_console` already sets. ## Other projects' code None. ## Proof in the real game Server thread (`horizon-ctl launch --world L --creative --offscreen`), engine from this branch with throwaway `eprintln!`s and a registered `lanecmd` (level 4) in the hook bodies (not in this PR): ``` ctl command 'lanecmd extra' -> {"chat":["lanecmd answered"],"ok":true} ctl chat '/lanecmd' -> (chat shows "lanecmd answered") ctl command 'list' -> {"chat":["There are 1 of a max of 8 players online: Player29448"],"ok":true} (vanilla, as before) TESTHOOK player_command Player29448 perm=4 cmd="lanecmd extra" TESTHOOK player_command Player29448 perm=4 cmd="lanecmd" ``` Dedicated server (regression check of #5815's path, which this does not touch): `lanecmd` on the console printed `TESTHOOK console_command "lanecmd"`, `list` still answered. Not run: the same on `main` without the change (the issue reports the "Unknown" answer); a real mod bundle built with horizon-mixins (the probe stands in for it). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base hr/main` on cachyos-x8664, against hr/main at 9f683428a, 6 min 12 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +11 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 586 passed (1 min 16 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (2 min 23 s) | | tests: horizon-client | ✅ 1803 passed (2 min 23 s) | | doc tests | ✅ 0 passed (4 s) | | 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 [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:25:41 +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#6728
No description provided.