[PR #345] [MERGED] Mods in the game: Options > Mods, hooks and HUD panels, off by default #2506

Closed
opened 2026-11-02 15:56:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/game-mods


📝 Commits (1)

  • 466e260 Mods in the game: load the ones turned on, hooks, HUD panels, Options > Mods

📊 Changes

13 files changed (+453 additions, -2 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client/Cargo.toml (+2 -0)
📝 crates/horizon-client/src/extras_hud.rs (+26 -0)
📝 crates/horizon-client/src/game.rs (+16 -1)
📝 crates/horizon-client/src/game/chat.rs (+8 -0)
📝 crates/horizon-client/src/game/commands.rs (+3 -0)
📝 crates/horizon-client/src/game/extras.rs (+5 -1)
➕ crates/horizon-client/src/game/mods.rs (+235 -0)
📝 crates/horizon-client/src/game/options.rs (+1 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
➕ crates/horizon-client/src/mod_list.rs (+112 -0)
📝 crates/horizon-client/src/options_horizon.rs (+32 -0)
📝 crates/horizon-client/src/settings.rs (+11 -0)

📄 Description

What

Part 4 of the mod foundation (design: #326; stacked on #329). Mods in the game, off and absent by default:

  • horizon-mods/ beside options.txt: .hmod files or mod folders are listed in Options > Mods (a new section) with what each may do ("May see your position, health and the time, draw text on your screen, show you chat messages.") and a switch. All start off; the choice is kept in horizon-mods.txt (mod.<id>:true), so options.txt stays vanilla. A failed or stopped mod shows why on its row.
  • Hooks, one line each in game.rs like the extras (game/mods.rs): tick, frame, /command before vanilla's dispatcher (vanilla names are refused at load), chat lines received, HUD panels stacked with the extras' corners (F3 hides the top-left ones, as for the extras). Mod chat lines show after the mod's name in gray; a stopped mod is reported in red.
  • --dev-mod PATH (repeatable, used by cargo horizon-mod run): always on, checked once a second and reloaded when rebuilt ("Mods reloaded").
  • Benchmarks (--benchmark) never load mods. With no mod on, Mods holds no engine; every hook is one is_running() check.

Screenshots (Mac mini, coords-hud installed and turned on)

  • HUD + /where, /coords: ~/code/horizon-parity/shots/mods/coords-hud.png
  • Options > Mods: ~/code/horizon-parity/shots/mods/mods-page.png

Frame time (same world and view, horizon-ctl bench 10 x3, offscreen, M4 Pro, 4 other sessions on the machine)

median frame mean FPS
no horizon-mods folder 2.62-2.71 ms 149-163
coords-hud on 2.72-2.78 ms 151-254
Medians differ by less than the run-to-run spread; the hook itself is 2.3 µs per tick (#328).

Binary size

Release horizon-client on macOS ARM64: 33.8 MB on main, 43.2 MB with the runtime (+9.4 MB, wasmtime + cranelift). Options if that matters: a mods cargo feature to ship builds without it, or wasmtime's Pulley interpreter instead of cranelift (smaller, slower mods).

How tested

In the game (release, offscreen, horizon-ctl): panel drawn and updated, /where (after a teleport, from a fresh snapshot), /coords hides/shows, a vanilla syntax error unaffected, the Mods switch writes and clears horizon-mods.txt, --dev-mod reload after a rebuild. Unit tests for mod_list.

cargo fmt --all -- --check                             ok
cargo clippy --workspace --all-targets -- -D warnings  ok
cargo test -p horizon-client                           ok (655 + 41 + 15 + ... passed, 0 failed)
cargo test -p horizon-mods -p horizon-mod-sdk -p coords-hud -p cargo-horizon-mod   ok
tools/parity.py --changed origin/main                  221/306 passed, 0 failed so far; the last 85 still running on the loaded Mac mini (local run, -j 2)

Needs Ludovic

  • The launcher Mods tab (browse/install/enable, CLI and MCP) is the next PR; this one is the in-game list.
  • Linux/Windows: the runtime is pure Rust (cranelift) and CI's Linux verify runs the sandbox tests; the game was only driven on macOS. No vscreen check on the desktop (it is off).

🤖 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/345 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/game-mods` --- ### 📝 Commits (1) - [`466e260`](https://github.com/horizon-rust/horizon/commit/466e26051450d08e6538eeb7588b1f58de9bb5ef) Mods in the game: load the ones turned on, hooks, HUD panels, Options > Mods ### 📊 Changes **13 files changed** (+453 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client/Cargo.toml` (+2 -0) 📝 `crates/horizon-client/src/extras_hud.rs` (+26 -0) 📝 `crates/horizon-client/src/game.rs` (+16 -1) 📝 `crates/horizon-client/src/game/chat.rs` (+8 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+3 -0) 📝 `crates/horizon-client/src/game/extras.rs` (+5 -1) ➕ `crates/horizon-client/src/game/mods.rs` (+235 -0) 📝 `crates/horizon-client/src/game/options.rs` (+1 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) ➕ `crates/horizon-client/src/mod_list.rs` (+112 -0) 📝 `crates/horizon-client/src/options_horizon.rs` (+32 -0) 📝 `crates/horizon-client/src/settings.rs` (+11 -0) </details> ### 📄 Description ## What Part 4 of the mod foundation (design: #326; stacked on #329). Mods in the game, **off and absent by default**: - `horizon-mods/` beside `options.txt`: `.hmod` files or mod folders are listed in **Options > Mods** (a new section) with what each may do ("May see your position, health and the time, draw text on your screen, show you chat messages.") and a switch. All start off; the choice is kept in `horizon-mods.txt` (`mod.<id>:true`), so `options.txt` stays vanilla. A failed or stopped mod shows why on its row. - Hooks, one line each in `game.rs` like the extras (`game/mods.rs`): tick, frame, `/command` before vanilla's dispatcher (vanilla names are refused at load), chat lines received, HUD panels stacked with the extras' corners (F3 hides the top-left ones, as for the extras). Mod chat lines show after the mod's name in gray; a stopped mod is reported in red. - `--dev-mod PATH` (repeatable, used by `cargo horizon-mod run`): always on, checked once a second and reloaded when rebuilt ("Mods reloaded"). - Benchmarks (`--benchmark`) never load mods. With no mod on, `Mods` holds no engine; every hook is one `is_running()` check. ## Screenshots (Mac mini, coords-hud installed and turned on) - HUD + `/where`, `/coords`: `~/code/horizon-parity/shots/mods/coords-hud.png` - Options > Mods: `~/code/horizon-parity/shots/mods/mods-page.png` ## Frame time (same world and view, `horizon-ctl bench 10` x3, offscreen, M4 Pro, 4 other sessions on the machine) | | median frame | mean FPS | |---|---|---| | no `horizon-mods` folder | 2.62-2.71 ms | 149-163 | | coords-hud on | 2.72-2.78 ms | 151-254 | Medians differ by less than the run-to-run spread; the hook itself is 2.3 µs per tick (#328). ## Binary size Release `horizon-client` on macOS ARM64: 33.8 MB on main, 43.2 MB with the runtime (+9.4 MB, wasmtime + cranelift). Options if that matters: a `mods` cargo feature to ship builds without it, or wasmtime's Pulley interpreter instead of cranelift (smaller, slower mods). ## How tested In the game (release, offscreen, horizon-ctl): panel drawn and updated, `/where` (after a teleport, from a fresh snapshot), `/coords` hides/shows, a vanilla syntax error unaffected, the Mods switch writes and clears `horizon-mods.txt`, `--dev-mod` reload after a rebuild. Unit tests for `mod_list`. ``` cargo fmt --all -- --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client ok (655 + 41 + 15 + ... passed, 0 failed) cargo test -p horizon-mods -p horizon-mod-sdk -p coords-hud -p cargo-horizon-mod ok tools/parity.py --changed origin/main 221/306 passed, 0 failed so far; the last 85 still running on the loaded Mac mini (local run, -j 2) ``` ## Needs Ludovic - The launcher Mods tab (browse/install/enable, CLI and MCP) is the next PR; this one is the in-game list. - Linux/Windows: the runtime is pure Rust (cranelift) and CI's Linux verify runs the sandbox tests; the game was only driven on macOS. No vscreen check on the desktop (it is off). 🤖 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-02 15:56:46 +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#2506
No description provided.