[PR #3464] [MERGED] Native mod settings: ask for the labels again when the page opens #4999

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3464
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: native-settings-refresh-on-open


📝 Commits (1)

  • 168bc8f Native mod settings: ask for the labels again when the page opens

📊 Changes

4 files changed (+60 additions, -2 deletions)

View changed files

📝 crates/horizon-client-render/src/options_ui.rs (+48 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+10 -1)
📝 crates/horizon-client/src/game/options.rs (+1 -0)
📝 crates/horizon-client/src/game/startup_menu.rs (+1 -1)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

A native mod's settings page (Options > Mods > a native mod > Settings) shows button labels that the mod returns
from the native_settings hook point. Horizon asks for them once, when list_native_mods builds the Mods list,
and again only after a click on one of the page's buttons (native_settings_event).

So after a language change, a mod's page still shows the old language until you click a button on it. The same
happens to labels that depend on the mod's own state, such as a count, which go stale between visits.

We found this while testing native mods (LookAt, SmartF3) on Windows. Their pages kept the old language after
switching languages.

Now, opening a native mod's page asks the mod for its labels again:

  • OptionsUi sends a new Event::NativeSettings(i) when it pushes Page::NativeMod(i);
  • the game handles it with native_settings_refresh(i), which is the label refresh that
    native_settings_event already did after a click, moved into its own function.

The startup menu ignores the event, as it does NativeButton. The hook point's doc now says it is asked again
"each time the page opens and after each click". The hook points' API doesn't change.

Vanilla reference

Horizon-only: native mods' settings pages. This follows vanilla's screens in spirit: they build their widgets,
and so their translated labels, in Screen.init each time they open.

Self-check

Run on Windows, with CARGO_TARGET_DIR set to an existing target folder:

cargo fmt --all -- --check                                                # clean
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings  # clean
cargo test -p horizon-client --features mods --lib -- options_ui::tests::   # 31 passed, 1 ignored
cargo test -p horizon-client --features mods --bin horizon-client -- native_hooks:: options   # 5 passed

The new test, options_ui::tests::opening_a_native_mods_page_asks_the_game_for_its_labels_again, fails without
the change: the page opens but no event asks for the labels.

tools/pr_ready.py wasn't run on this machine; I can paste its block once it has run.

Rebased on main after #3186

Rebased on main after #3186 (62a01db8f). options_ui.rs moved to crates/horizon-client-render/src/options_ui.rs, so Event::NativeSettings and the new test are there now. game/native_hooks.rs, game/options.rs and game/startup_menu.rs stay in horizon-client.

Self-check after the rebase

Run on Windows, with CARGO_TARGET_DIR set to an existing target folder:

cargo fmt --all -- --check                                                    # clean
cargo clippy -p horizon-client-render --all-targets -- -D warnings            # clean
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings   # clean
cargo test -p horizon-client-render --lib -- options_ui::tests::              # 31 passed, 1 ignored
cargo test -p horizon-client --features mods --bin horizon-client -- native_hooks:: options   # 5 passed

The new test, options_ui::tests::opening_a_native_mods_page_asks_the_game_for_its_labels_again (now in horizon-client-render), fails without the change: the page opens but no event asks for the labels.

🤖 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/3464 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `native-settings-refresh-on-open` --- ### 📝 Commits (1) - [`168bc8f`](https://github.com/horizon-rust/horizon/commit/168bc8ffd529f460c50ba95337e1cfda097553c3) Native mod settings: ask for the labels again when the page opens ### 📊 Changes **4 files changed** (+60 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/options_ui.rs` (+48 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+10 -1) 📝 `crates/horizon-client/src/game/options.rs` (+1 -0) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+1 -1) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why A native mod's settings page (Options > Mods > a native mod > Settings) shows button labels that the mod returns from the `native_settings` hook point. Horizon asks for them once, when `list_native_mods` builds the Mods list, and again only after a click on one of the page's buttons (`native_settings_event`). So after a language change, a mod's page still shows the old language until you click a button on it. The same happens to labels that depend on the mod's own state, such as a count, which go stale between visits. We found this while testing native mods (LookAt, SmartF3) on Windows. Their pages kept the old language after switching languages. Now, opening a native mod's page asks the mod for its labels again: - `OptionsUi` sends a new `Event::NativeSettings(i)` when it pushes `Page::NativeMod(i)`; - the game handles it with `native_settings_refresh(i)`, which is the label refresh that `native_settings_event` already did after a click, moved into its own function. The startup menu ignores the event, as it does `NativeButton`. The hook point's doc now says it is asked again "each time the page opens and after each click". The hook points' API doesn't change. ## Vanilla reference Horizon-only: native mods' settings pages. This follows vanilla's screens in spirit: they build their widgets, and so their translated labels, in `Screen.init` each time they open. ## Self-check Run on Windows, with `CARGO_TARGET_DIR` set to an existing target folder: ``` cargo fmt --all -- --check # clean cargo clippy -p horizon-client --features mods --all-targets -- -D warnings # clean cargo test -p horizon-client --features mods --lib -- options_ui::tests:: # 31 passed, 1 ignored cargo test -p horizon-client --features mods --bin horizon-client -- native_hooks:: options # 5 passed ``` The new test, `options_ui::tests::opening_a_native_mods_page_asks_the_game_for_its_labels_again`, fails without the change: the page opens but no event asks for the labels. `tools/pr_ready.py` wasn't run on this machine; I can paste its block once it has run. ## Rebased on main after #3186 Rebased on main after #3186 (62a01db8f). `options_ui.rs` moved to `crates/horizon-client-render/src/options_ui.rs`, so `Event::NativeSettings` and the new test are there now. `game/native_hooks.rs`, `game/options.rs` and `game/startup_menu.rs` stay in horizon-client. ### Self-check after the rebase Run on Windows, with `CARGO_TARGET_DIR` set to an existing target folder: ``` cargo fmt --all -- --check # clean cargo clippy -p horizon-client-render --all-targets -- -D warnings # clean cargo clippy -p horizon-client --features mods --all-targets -- -D warnings # clean cargo test -p horizon-client-render --lib -- options_ui::tests:: # 31 passed, 1 ignored cargo test -p horizon-client --features mods --bin horizon-client -- native_hooks:: options # 5 passed ``` The new test, `options_ui::tests::opening_a_native_mods_page_asks_the_game_for_its_labels_again` (now in horizon-client-render), fails without the change: the page opens but no event asks for the labels. 🤖 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 05:09:29 +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#4999
No description provided.