Skip to content

Commit 0dc33f0

Browse files
committed
unscuff new tooltip UI
- Removes tooltips when paused - Playing cards no longer use the new UI - Consumables no longer use the new UI when Incantation is installed - The Collection now uses the new UI
1 parent e000a4d commit 0dc33f0

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

lib/ui.lua

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,48 @@ function Card:move(dt)
229229
m(self, dt)
230230
if self.children.h_popup then
231231
self.children.h_popup.states.collide.can = true
232-
if not self.highlighted and not self.states.hover.is then
232+
if not self:force_popup() and not self.states.hover.is then
233233
self.children.h_popup:remove()
234234
self.children.h_popup = nil
235235
end
236236
end
237237
end
238+
239+
-- This defines when we should show a card's description even when it's not hovered
240+
function Card:force_popup()
241+
-- Must be selected
242+
if self.highlighted then
243+
-- Remove all popups in the pause menu (collection excluded)
244+
if G.SETTINGS.paused and not self.area.config.collection then
245+
return false
246+
end
247+
-- Playing cards
248+
if self.config.center.set == "Default" or self.config.center.set == "Base" or self.config.center.set == "Enhanced" then
249+
return false
250+
end
251+
-- Incantation mod compat
252+
if SMODS.Mods["incantation"] and self.area == G.consumeables then
253+
return false
254+
end
255+
return true
256+
end
257+
end
258+
259+
-- Hacky hook to make cards selectable in the collection
260+
-- Unfortunately this doesn't play nicely with gameset UI
261+
local cainit = CardArea.init
262+
function CardArea:init(X, Y, W, H, config)
263+
if config.collection then
264+
print("m")
265+
config.highlight_limit = config.card_limit
266+
end
267+
return cainit(self, X, Y, W, H, config)
268+
end
269+
270+
local cach = CardArea.can_highlight
271+
function CardArea:can_highlight(card)
272+
if self.config.collection then
273+
return true
274+
end
275+
return cach(self)
276+
end

localization/en-us.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3922,11 +3922,11 @@ return {
39223922
},
39233923
},
39243924
ev_cry_choco0 = {
3925-
name = "",
3925+
name = "Possible Events",
39263926
text = {
3927-
"Possible events:",
39283927
"{T:ev_cry_choco1}1{} {T:ev_cry_choco2}2{} {T:ev_cry_choco3}3{} {T:ev_cry_choco4}4{} {T:ev_cry_choco5}5{}",
39293928
"{T:ev_cry_choco6}6{} {T:ev_cry_choco7}7{} {T:ev_cry_choco8}8{} {T:ev_cry_choco9}9{} {T:ev_cry_choco10}10{}",
3929+
"{C:inactive}(Hover for info)"
39303930
},
39313931
},
39323932
ev_cry_choco1 = {

lovely/lib_ui.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ target = "engine/node.lua"
7878
pattern = "if self.children.h_popup then"
7979
position = 'at'
8080
match_indent = true
81-
payload = "if self.children.h_popup and not self.highlighted then"
81+
payload = "if self.children.h_popup and not (self.force_popup and self:force_popup()) then"
8282

8383
# Let description tooltips work for any object
8484
[[patches]]

0 commit comments

Comments
 (0)