Skip to content

Commit 9edcff3

Browse files
authored
align_buttons cardarea config option (#1148)
1 parent b634beb commit 9edcff3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lovely/cardareas.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,37 @@ G.playing_cards = {}
1515
set_screen_positions()
1616
'''
1717
payload = '''
18+
-- Add align config to existing areas that should use it
19+
self.jokers.config.align_buttons = true
20+
self.consumeables.config.align_buttons = true
21+
1822
for _, mod in ipairs(SMODS.mod_list) do
1923
if mod.can_load and mod.custom_card_areas and type(mod.custom_card_areas) == "function" then
2024
mod.custom_card_areas(self)
2125
end
2226
end
27+
'''
28+
29+
# Check area.config.align_buttons if an area should align buttons like normal
30+
[[patches]]
31+
[patches.pattern]
32+
target = 'card.lua'
33+
match_indent = true
34+
position = 'at'
35+
pattern = '''
36+
((self.area == G.jokers) or (self.area == G.consumeables)) and "cr" or
37+
'''
38+
payload = '''
39+
self.area.config.align_buttons and "cr" or
40+
'''
41+
[[patches]]
42+
[patches.pattern]
43+
target = 'card.lua'
44+
match_indent = true
45+
position = 'at'
46+
pattern = '''
47+
((self.area == G.jokers) or (self.area == G.consumeables)) and {x=x_off - 0.4,y=0} or
48+
'''
49+
payload = '''
50+
self.area.config.align_buttons and {x=x_off - 0.4,y=0} or
2351
'''

0 commit comments

Comments
 (0)