Skip to content

Commit 4413b77

Browse files
committed
use new tooltip enum identifiers
1 parent a7aede5 commit 4413b77

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

gui/notify.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
local gui = require('gui')
44
local notifications = reqscript('internal/notify/notifications')
55
local overlay = require('plugins.overlay')
6+
local utils = require('utils')
67
local widgets = require('gui.widgets')
78

89
--
@@ -87,6 +88,25 @@ function NotifyOverlay:overlay_onupdate()
8788
self.visible = #choices > 0
8889
end
8990

91+
local CONFLICTING_TOOLTIPS = utils.invert{
92+
df.main_hover_instruction.InfoUnits,
93+
df.main_hover_instruction.InfoJobs,
94+
df.main_hover_instruction.InfoPlaces,
95+
df.main_hover_instruction.InfoLabors,
96+
df.main_hover_instruction.InfoWorkOrders,
97+
df.main_hover_instruction.InfoNobles,
98+
df.main_hover_instruction.InfoObjects,
99+
df.main_hover_instruction.InfoJustice,
100+
}
101+
102+
local mi = df.global.game.main_interface
103+
104+
function NotifyOverlay:render(dc)
105+
if not CONFLICTING_TOOLTIPS[mi.current_hover] then
106+
NotifyOverlay.super.render(self, dc)
107+
end
108+
end
109+
90110
OVERLAY_WIDGETS = {
91111
panel=NotifyOverlay,
92112
}

internal/confirm/specs.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ ConfirmSpec{
198198
message='Are you sure you want to delete this route?',
199199
intercept_keys='_MOUSE_L',
200200
context='dwarfmode/Hauling',
201-
predicate=function() return mi.current_hover == 180 end,
201+
predicate=function() return mi.current_hover == df.main_hover_instruction.RouteRemove end,
202202
pausable=true,
203203
}
204204

@@ -208,7 +208,7 @@ ConfirmSpec{
208208
message='Are you sure you want to delete this stop?',
209209
intercept_keys='_MOUSE_L',
210210
context='dwarfmode/Hauling',
211-
predicate=function() return mi.current_hover == 185 end,
211+
predicate=function() return mi.current_hover == df.main_hover_instruction.StopRemove end,
212212
pausable=true,
213213
}
214214

@@ -219,7 +219,7 @@ ConfirmSpec{
219219
intercept_keys='_MOUSE_L',
220220
context='dwarfmode/ViewSheets/BUILDING/TradeDepot',
221221
predicate=function()
222-
return mi.current_hover == 301 and has_caravans()
222+
return mi.current_hover == df.main_hover_instruction.BuildingRemove and has_caravans()
223223
end,
224224
}
225225

@@ -229,7 +229,7 @@ ConfirmSpec{
229229
message='Are you sure you want to disband this squad?',
230230
intercept_keys='_MOUSE_L',
231231
context='dwarfmode/Squads',
232-
predicate=function() return mi.current_hover == 343 end,
232+
predicate=function() return mi.current_hover == df.main_hover_instruction.SquadDisband end,
233233
pausable=true,
234234
}
235235

@@ -424,7 +424,7 @@ ConfirmSpec{
424424
message='Are you sure you want to remove this manager order?',
425425
intercept_keys='_MOUSE_L',
426426
context='dwarfmode/Info/WORK_ORDERS/Default',
427-
predicate=function() return mi.current_hover == 222 end,
427+
predicate=function() return mi.current_hover == df.main_hover_instruction.ManagerOrderRemove end,
428428
pausable=true,
429429
}
430430

@@ -446,7 +446,8 @@ ConfirmSpec{
446446
intercept_keys='_MOUSE_L',
447447
context='dwarfmode/Burrow',
448448
predicate=function()
449-
return mi.current_hover == 171 or mi.current_hover == 168
449+
return mi.current_hover == df.main_hover_instruction.BurrowRemove or
450+
mi.current_hover == df.main_hover_instruction.BurrowRemovePaint
450451
end,
451452
pausable=true,
452453
}
@@ -457,7 +458,7 @@ ConfirmSpec{
457458
message='Are you sure you want to remove this stockpile?',
458459
intercept_keys='_MOUSE_L',
459460
context='dwarfmode/Stockpile',
460-
predicate=function() return mi.current_hover == 118 end,
461+
predicate=function() return mi.current_hover == df.main_hover_instruction.StockpileRemove end,
461462
pausable=true,
462463
}
463464

0 commit comments

Comments
 (0)