Skip to content

Commit 2c294ad

Browse files
authored
Add missing stake loc_vars patches and overrides (#1123)
1 parent bd132c0 commit 2c294ad

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lovely/stake.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,23 @@ pattern = '''
259259
payload = '''
260260
{n=G.UIT.T, config={text = localize{type = 'name_text', key = t.key, set = t.set}, scale = 0.35, colour = G.C.WHITE}}
261261
'''
262+
263+
# Stake loc_vars pt 3
264+
[[patches]]
265+
[patches.pattern]
266+
target = 'functions/UI_definitions.lua'
267+
match_indent = true
268+
position = 'at'
269+
pattern = '''
270+
localize{type = 'descriptions', key = _stake_center.key, set = _stake_center.set, nodes = _stake_desc}
271+
'''
272+
payload = '''
273+
local t, res = {}, {}
274+
if _stake_center.loc_vars and type(_stake_center.loc_vars) == 'function' then
275+
res = _stake_center:loc_vars() or {}
276+
end
277+
t.vars = res.vars or {}
278+
t.key = res.key or _stake_center.key
279+
t.set = res.set or _stake_center.set
280+
localize{type = 'descriptions', key = t.key, set = t.set, nodes = _stake_desc, vars = t.vars}
281+
'''

src/overrides.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,14 @@ function SMODS.applied_stakes_UI(i, stake_desc_rows, num_added)
517517
local i = G.P_STAKES[v].stake_level
518518
local _stake_desc = {}
519519
local _stake_center = G.P_CENTER_POOLS.Stake[i]
520-
localize { type = 'descriptions', key = _stake_center.key, set = _stake_center.set, nodes = _stake_desc }
520+
local t, res = {}, {}
521+
if _stake_center.loc_vars and type(_stake_center.loc_vars) == 'function' then
522+
res = _stake_center:loc_vars() or {}
523+
end
524+
t.vars = res.vars or {}
525+
t.key = res.key or _stake_center.key
526+
t.set = res.set or _stake_center.set
527+
localize { type = 'descriptions', key = t.key, set = t.set, nodes = _stake_desc, vars = t.vars }
521528
local _full_desc = {}
522529
for k, v in ipairs(_stake_desc) do
523530
_full_desc[#_full_desc + 1] = {n = G.UIT.R, config = {align = "cm"}, nodes = v}

0 commit comments

Comments
 (0)