Skip to content

Commit 9dfb47e

Browse files
committed
Add tooltip for pump down buttons on info view
1 parent cf60178 commit 9dfb47e

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

data/lang/ui-core/en.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,6 +2063,22 @@
20632063
"description": "Drain the fuel tank",
20642064
"message": "Pump down"
20652065
},
2066+
"PUMP_DOWN_FROM_CARGO_TOOLTIP": {
2067+
"description": "Tooltip for Info screen",
2068+
"message": "Pump %i t from cargo"
2069+
},
2070+
"PUMP_DOWN_FROM_HYPERDRIVE_TOOLTIP": {
2071+
"description": "Tooltip for Info screen",
2072+
"message": "Pump %i t from hyperdrive to fuel tanks"
2073+
},
2074+
"PUMP_DOWN_TO_CARGO_TOOLTIP": {
2075+
"description": "Tooltip for Info screen",
2076+
"message": "Pump %i t to cargo"
2077+
},
2078+
"PUMP_DOWN_TO_HYPERDRIVE_TOOLTIP": {
2079+
"description": "Tooltip for Info screen",
2080+
"message": "Pump %i t to hyperdrive from fuel tanks"
2081+
},
20662082
"PURCHASE_PAINTJOB": {
20672083
"description": "Paintshop button",
20682084
"message": "Purchase Paintjob"

data/pigui/modules/info-view/03-econ-trade.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ local pionillium = ui.fonts.pionillium
2020
local orbiteer = ui.fonts.orbiteer
2121
local Vector2 = _G.Vector2
2222

23-
local iconSize = ui.rescaleUI(Vector2(28, 28))
24-
local buttonSpaceSize = iconSize
2523
-- FIXME: need to manually set itemSpacing to be able to properly size columns
2624
-- Need a style-var query system for best effect
2725
local itemSpacing = ui.rescaleUI(Vector2(6, 12), Vector2(1600, 900))
@@ -229,8 +227,9 @@ local function fuelTransferButton(drive, amt)
229227

230228
local color = driveEnabled and ui.theme.buttonColors.disabled or ui.theme.buttonColors.default
231229
local icon = amt < 0 and icons.chevron_down or icons.chevron_up
230+
local tooltip = amt < 0 and l.PUMP_DOWN_FROM_HYPERDRIVE_TOOLTIP or l.PUMP_DOWN_TO_HYPERDRIVE_TOOLTIP
232231

233-
if ui.button(ui.get_icon_glyph(icon) .. tostring(math.abs(amt)), Vector2(100, 0), color) then
232+
if ui.button(ui.get_icon_glyph(icon) .. tostring(math.abs(amt)), Vector2(100, 0), color, string.format(tooltip, math.abs(amt))) then
234233
if not driveEnabled then
235234
if drive.fuel == Commodities.hydrogen then
236235
transfer_hyperfuel_hydrogen(drive, amt)
@@ -286,7 +285,7 @@ local function drawPumpDialog()
286285
ui.sameLine(width)
287286
local options = {1, 10, 100}
288287
for _, k in ipairs(options) do
289-
if ui.button(tostring(k) .. "##fuel", Vector2(100, 0)) then
288+
if ui.button(tostring(k) .. "##fuel", Vector2(100, 0), nil, string.format(l.PUMP_DOWN_FROM_CARGO_TOOLTIP, k)) then
290289
-- Refuel k tonnes from cargo hold
291290
Game.player:Refuel(Commodities.hydrogen, k)
292291
end
@@ -301,7 +300,7 @@ local function drawPumpDialog()
301300
ui.sameLine(width)
302301
for _, v in ipairs(options) do
303302
local fuel = -1*v
304-
if ui.button(fuel .. "##pump", Vector2(100, 0)) then
303+
if ui.button(fuel .. "##pump", Vector2(100, 0), nil, string.format(l.PUMP_DOWN_TO_CARGO_TOOLTIP, v)) then
305304
pumpDown(fuel)
306305
end
307306
ui.sameLine()

0 commit comments

Comments
 (0)