Lua Hooks extension and D2-Style Tooltip mod.#8470
Open
Rasti-i wants to merge 6 commits intodiasurgical:masterfrom
Open
Lua Hooks extension and D2-Style Tooltip mod.#8470Rasti-i wants to merge 6 commits intodiasurgical:masterfrom
Rasti-i wants to merge 6 commits intodiasurgical:masterfrom
Conversation
Introduce a dedicated infobox Lua module, wire infobox-related Lua events and rendering hooks, and add the Tooltips Lua mod with item comparison and hint behavior. Keep items module aligned with master and move unique info-box visibility hooks under devilutionx.infobox for module cohesion.
yuripourre
reviewed
Feb 15, 2026
aef0c82 to
9d80e43
Compare
yuripourre
reviewed
Feb 20, 2026
| if (ShowUniqueItemInfoBox) { | ||
| DrawUniqueInfo(out); | ||
| LuaEvent("BeforeUniqueInfoBoxDraw"); | ||
| if (ShowUniqueItemInfoBox) |
Collaborator
There was a problem hiding this comment.
This will always be truthy right?
yuripourre
reviewed
Feb 21, 2026
| __doc_OnPlayerGainExperience = "Called when Player gains experience.", | ||
|
|
||
| ---Called before an info box is rendered. Passes hovered item (or nil) and whether it is floating. | ||
| InfoBoxPrepare = CreateEvent(), |
Collaborator
There was a problem hiding this comment.
Do we really need those 3 events? Do you think we can have an event that triggers when user hovers the item and your module listens to the event and triggers the render logic?
yuripourre
reviewed
Feb 21, 2026
| "Returns the screen width", []() { return gnScreenWidth; }); | ||
| LuaSetDocFn(table, "screen_height", "()", | ||
| "Returns the screen height", []() { return gnScreenHeight; }); | ||
| LuaSetDocFn(table, "drawHalfTransparentRect", "(x: integer, y: integer, width: integer, height: integer, passes: integer = 1)", |
Collaborator
There was a problem hiding this comment.
This file could be a separate PR. With groundwork for the infobox PR.
yuripourre
reviewed
Feb 21, 2026
| size_t lineIndex = 0; | ||
| for (const std::string_view &line : lines) { | ||
| if (lineColors.hasDividerBeforeLine(lineIndex) && lineIndex > 0) { | ||
| DrawHalfTransparentHorizontalLine(out, { linePos.x, linePos.y - (lineHeight / 2) }, rect.size.width, PAL16_GRAY + 10); |
Collaborator
There was a problem hiding this comment.
I am little confused, if you rendering the infobox using a cpp file, why do you need the lua methods (or vice-versa)?
🤔
yuripourre
reviewed
Feb 21, 2026
| prev = it; | ||
| } | ||
|
|
||
| auto inserted = actions.emplace_after(prev, key, name, description, defaultInput, std::move(actionPressed), std::move(actionReleased), std::move(enable), index); |
Collaborator
There was a problem hiding this comment.
I think it worth a comment here, why it is necessary?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces a new infobox Lua module, wire infobox-related Lua events and rendering hooks, and add a new default Tooltips Lua mod with Color/Text formatting, item comparison and hint behavior.
events.luaInfoBoxPrepare, AfterFloatingInfoBoxDraw, BeforeUniqueInfoBoxDraw.control_infobox.cppand before unique-item panel draw inscrollrt.cpplua_global.hppandlua_global.cpp, enabling conditional hook paths.per-line and in-line text coloring/dividers,
formatting changes following D2/D2R style,
toggling of unique info box rendering and printing of unique powers to the tooltip if floating infobox setting is enabled,
dynamic action hints(currently only in English),
Shift comparison for an additional floating panel with equipped items. (if floating infobox turned on)
Closes #8431
Floating infoboxes enabled:

Floating infoboxes disabled:

Gamepad support:
