Draft: Dehardcode tooltips

No ticket

Lua Tooltips

Adds a new interface: Tooltips

Features

  • tracks the current tooltip object, using a hidden engine handler
    • Works for both world objects and container objects
  • automatically creates, shows, and positions the tooltip for the current tooltip object if applicable
  • tooltip object can be either a game object or a record ID
  • getter/setter for tooltip object
  • function for creating a tooltip layout
  • handlers for creating/destroying tooltips

Note that Tooltips are currently only partially dehardcoded. Tooltips are implemented for spells and game objects only. Remaining tooltips are not tied to records/game objects engine-side, and will therefore be more work to expose to the lua side.

I indend to bring attributes/skills, and anything else that can be represented as records, to lua as part of this MR. The rest will be deferred to future MRs as they may require greater additions/changes. Or may not be reasonable to do without dehardcoding relevant UI altogether.

What has been dehardcoded

  • All tooltips
  • Setting for show owned object
  • Setting for soul gem value rebalance

What remains hardcoded

Tooltip requests. All tooltips are made requested from the engine only, there are no built-in scripts using the Tooltips interface.

Other remarks

World tooltips, meaning the tooltips shown above the object in your crosshairs, are not possible to position identically to how the engine does without a wobbly result. This is due to frame delays that means each frame's tooltip placement will correspond to the camera 1 or 2 frames ago, which is inaccurate when the player is actively moving the camera.


TODO

  • Each tooltip line should be assigned a name, so that the vertical flex content of the tooltip layout be indexable by name
  • Some @usage documentation
  • Identify remaining tooltips
  • Owned objects + setting
  • Soul gem rebalance + setting
Edited by Mads Buvik Sandvei

Merge request reports

Loading
Loading