Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create gui/tooltips.lua: show info (f.e. job name) at units and/or mouse cursor #1365

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

TymurGubayev
Copy link
Contributor

image

The script shows some info (currently: name of the job) in tooltips (sort of...) following units and or mouse (see screenshot).

@myk002
Copy link
Member

myk002 commented Jan 6, 2025

I am intrigued and delighted : )

@myk002
Copy link
Member

myk002 commented Jan 6, 2025

Let me finish reviewing DFHack/dfhack#4959 so getUnitsInBox no longer returns inactive units

image

@@ -0,0 +1,281 @@
-- Show tooltips on units and/or mouse

local RELOAD = false -- set to true when actively working on this script
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, devel/clear-script-env has the same effect:

multicmd devel/clear-script-env gui/tooltips; gui/tooltips

gui/tooltips.lua Outdated Show resolved Hide resolved
:tags: fort inspection

This script shows "tooltips" following units and/or mouse with job names.

Copy link
Member

@myk002 myk002 Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs disclaimer that tooltips will show over any vanilla UI elements:
image

The dig ascii overlays suffer from the same problem. I don't know of any good solution here. I'm not saying that any behavior needs to change -- just needs to be documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added an **IMPORTANT NOTE** at the beginning of the description text

docs/gui/tooltips.rst Outdated Show resolved Hide resolved
:summary: Show tooltips with useful info.
:tags: fort inspection

This script shows "tooltips" following units and/or mouse with job names.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs more description of the two options and their effects.

Copy link
Contributor Author

@TymurGubayev TymurGubayev Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a bit of clarification...
It's kind of hard to describe though

Comment on lines +81 to +83
local function GetTooltipText(x,y,z)
local txt = {}
local units = dfhack.units.getUnitsInBox(x,y,z,x,y,z) or {} -- todo: maybe (optionally) use filter parameter here?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can take a pos param to this function and pass pos, pos to getUnitsInBox -- it supports pos params as of DFHack/dfhack#5146

gui/tooltips.lua Outdated Show resolved Hide resolved

-- -> map viewport offset
local vp = df.global.world.viewport
local vp_Coord = vp.window_x -- is actually coord
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field appears to be misnamed -- let me correct that to just window (or maybe "corner" since that's how it's named in the DF headers)

DFHack/df-structures#818

Copy link
Member

@myk002 myk002 Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the structure field rename PR has been merged. it's now called vp.corner

gui/tooltips.lua Outdated Show resolved Hide resolved
gui/tooltips.lua Show resolved Hide resolved
TymurGubayev and others added 2 commits January 6, 2025 11:16
Co-authored-by: Myk <myk.taylor@gmail.com>
Co-authored-by: Myk <myk.taylor@gmail.com>
@myk002
Copy link
Member

myk002 commented Jan 6, 2025

Btw this PR has started some discussion on the Discord server where your input would be valuable: https://discord.com/channels/793331351645323264/807444515194798090/1325754489659195502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants