[PR #5605] [MERGED] Native mods: image components inside item tooltips #6382

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

📋 Pull Request Information

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

Base: main ← Head: native/image-tooltips


📝 Commits (1)

  • 4497abe feat(mods): support image tooltip components

📊 Changes

4 files changed (+126 additions, -24 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+1 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+19 -0)
📝 crates/horizon-client/src/game/stations.rs (+90 -23)
➕ tools/native-hook-fragments/image_tooltips.json (+16 -0)

📄 Description

🤖 Opened by Xmilon's AI agent (Codex, GPT-6), not by Xmilon personally.

What and why

Fixes #5534. Part of #4953.

Native mods can provide a stack-dependent image component inside an item tooltip. Two client catalog hooks share the stack as component data:

  • tooltip_component(stack, size) answers a finite positive width/height in GUI pixels.
  • tooltip_component_draw(stack, batch, origin, size) renders it with the existing native_sprite, native_fill and native_text helpers.

The tooltip background reserves the measured height, and its width participates in the existing cursor/screen-edge positioning. The component follows the text and any vanilla bundle component. Empty hooks preserve ordinary and bundle-only tooltips; invalid measurements reserve nothing and do not call the renderer. A mod can answer for any item identifier and inspect the stack's existing component data.

The existing tooltip position calculation is extracted without changing its rules, making the expanded box's positioning testable without a renderer. Updated all tooltip_geometry callers, including smithing template tooltips. Registration/documentation uses the image_tooltips fragment; no API number or generated catalog edit.

Kind

  • feature: something new for players

Vanilla reference

Horizon-only native hook surface, following TooltipComponent / ClientTooltipComponent measurement and drawing. Existing bundle tooltip and background rendering are reused. No vanilla algorithm is replaced. No external project source was read or copied.

Other projects' code

None.

Self-check

Windows, RUST_MIN_STACK=33554432, -j1:

  • cargo fmt --all -- --check: pass.
  • cargo clippy -p horizon-client --lib --bins --tests -- -D warnings: pass.
  • Actual measurement/position helpers and their two tests compiled and executed in an isolated rustc test: 2 passed. Covers no component, valid dimensions, zero/negative/NaN/infinite dimensions, text-sized baseline positioning, a wide image moving the entire tooltip left, and a tall image moving it above the bottom edge.
  • Full workspace/client tests are left to upstream CI under the contributor's local build constraints. CI run 41256914676 currently awaits maintainer approval (action_required); CI is not yet verified. PR-label and overlap checks passed.

Visual validation

Not verified in-game and no screenshot: no prepared resources in this checkout, and no full local client rebuild was run. The two pure layout tests do not establish visual rendering or texture correctness. Vanilla parity was not run locally. These limitations are explicit for review.

🤖 Generated with Codex


🔄 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/5605 **Author:** [@Xmilon](https://github.com/Xmilon) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `native/image-tooltips` --- ### 📝 Commits (1) - [`4497abe`](https://github.com/horizon-rust/horizon/commit/4497abec984c9613d552d2afebd0c51ea76064cd) feat(mods): support image tooltip components ### 📊 Changes **4 files changed** (+126 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+19 -0) 📝 `crates/horizon-client/src/game/stations.rs` (+90 -23) ➕ `tools/native-hook-fragments/image_tooltips.json` (+16 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Codex, GPT-6), not by Xmilon personally. ## What and why Fixes #5534. Part of #4953. Native mods can provide a stack-dependent image component inside an item tooltip. Two client catalog hooks share the stack as component data: - `tooltip_component(stack, size)` answers a finite positive width/height in GUI pixels. - `tooltip_component_draw(stack, batch, origin, size)` renders it with the existing native_sprite, native_fill and native_text helpers. The tooltip background reserves the measured height, and its width participates in the existing cursor/screen-edge positioning. The component follows the text and any vanilla bundle component. Empty hooks preserve ordinary and bundle-only tooltips; invalid measurements reserve nothing and do not call the renderer. A mod can answer for any item identifier and inspect the stack's existing component data. The existing tooltip position calculation is extracted without changing its rules, making the expanded box's positioning testable without a renderer. Updated all tooltip_geometry callers, including smithing template tooltips. Registration/documentation uses the image_tooltips fragment; no API number or generated catalog edit. ## Kind - [x] feature: something new for players ## Vanilla reference Horizon-only native hook surface, following TooltipComponent / ClientTooltipComponent measurement and drawing. Existing bundle tooltip and background rendering are reused. No vanilla algorithm is replaced. No external project source was read or copied. ## Other projects' code None. ## Self-check Windows, RUST_MIN_STACK=33554432, -j1: - cargo fmt --all -- --check: pass. - cargo clippy -p horizon-client --lib --bins --tests -- -D warnings: pass. - Actual measurement/position helpers and their two tests compiled and executed in an isolated rustc test: 2 passed. Covers no component, valid dimensions, zero/negative/NaN/infinite dimensions, text-sized baseline positioning, a wide image moving the entire tooltip left, and a tall image moving it above the bottom edge. - Full workspace/client tests are left to upstream CI under the contributor's local build constraints. [CI run 41256914676](https://github.com/horizon-rust/horizon/actions/runs/41256914676) currently awaits maintainer approval (`action_required`); CI is not yet verified. PR-label and overlap checks passed. ## Visual validation Not verified in-game and no screenshot: no prepared resources in this checkout, and no full local client rebuild was run. The two pure layout tests do not establish visual rendering or texture correctness. Vanilla parity was not run locally. These limitations are explicit for review. 🤖 Generated with [Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:19:44 +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#6382
No description provided.