Skip to content

Commit

Permalink
add more loc_vars functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurelius7309 committed Dec 24, 2024
1 parent de1e84f commit b8d3a31
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
18 changes: 11 additions & 7 deletions lovely/blind.toml
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,17 @@ payload = '''
[patches.pattern]
target = 'blind.lua'
pattern = "local loc_target = localize{type = 'raw_descriptions', key = self.config.blind.key, set = 'Blind', vars = loc_vars or self.config.blind.vars}"
position = 'before'
position = 'at'
match_indent = true
payload = '''
local target = {type = 'raw_descriptions', key = self.config.blind.key, set = 'Blind', vars = loc_vars or self.config.blind.vars}
local obj = self.config.blind
if obj.loc_vars and type(obj.loc_vars) == 'function' then
local res = obj:loc_vars() or {}
loc_vars = res.vars or {}
end'''
target.vars = res.vars or target.vars
target.key = res.key or target.key
end
local loc_target = localize(target)'''

# Blind:load()
[[patches]]
Expand Down Expand Up @@ -301,16 +304,17 @@ pattern = "local loc_target = localize{type = 'raw_descriptions', key = blind_ch
match_indent = true
position = 'at'
payload = '''
local loc_vars = nil
local target = {type = 'raw_descriptions', key = self.config.blind.key, set = 'Blind', vars = loc_vars or self.config.blind.vars}
if blind_choice.config.name == 'The Ox' then
loc_vars = {localize(G.GAME.current_round.most_played_poker_hand, 'poker_hands')}
target.vars = {localize(G.GAME.current_round.most_played_poker_hand, 'poker_hands')}
end
local obj = blind_choice.config
if obj.loc_vars and _G['type'](obj.loc_vars) == 'function' then
local res = obj:loc_vars() or {}
loc_vars = res.vars or {}
target.vars = res.vars or target.vars
target.key = res.key or target.key
end
local loc_target = localize{type = 'raw_descriptions', key = blind_choice.config.key, set = 'Blind', vars = loc_vars or blind_choice.config.vars}'''
local loc_target = localize(target)'''

# create_UIBox_blind_popup()
[[patches]]
Expand Down
21 changes: 20 additions & 1 deletion lovely/center.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,30 @@ pattern = "(?<indent>[\t ]+)if (?<rest>_c.name == 'Golden Ticket' then)"
line_prepend = '$indent'
position = 'at'
payload = '''
local res = {}
if _c.locked_loc_vars and type(_c.locked_loc_vars) == 'function' then
local res = _c:locked_loc_vars(info_queue) or {}
res = _c:locked_loc_vars(info_queue) or {}
loc_vars = res.vars or {}
specific_vars = specific_vars or {}
specific_vars.not_hidden = res.not_hidden or specific_vars.not_hidden
elseif $rest'''

[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
position = 'at'
match_indent = true
pattern = "localize{type = 'unlocks', key = 'joker_locked_legendary', set = 'Other', nodes = desc_nodes, vars = loc_vars}"
payload = "localize{type = 'unlocks', key = res.key or 'joker_locked_legendary', set = res.set or 'Other', nodes = desc_nodes, vars = loc_vars, text_colour = res.text_colour, scale = res.scale}"

[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
position = 'at'
match_indent = true
pattern = "localize{type = 'unlocks', key = _c.key, set = _c.set, nodes = desc_nodes, vars = loc_vars}"
payload = "localize{type = 'unlocks', key = res.key or _c.key, set = res.set or _c.set, nodes = desc_nodes, vars = loc_vars, text_colour = res.text_colour, scale = res.scale}"

[[patches]]
[patches.pattern]
target = 'functions/common_events.lua'
Expand All @@ -126,6 +143,8 @@ match_indent = true
pattern = 'elseif desc_nodes ~= full_UI_table.main then'
payload = 'elseif desc_nodes ~= full_UI_table.main and not desc_nodes.name then'



# check_for_unlock()
[[patches]]
[patches.regex]
Expand Down
1 change: 1 addition & 0 deletions lovely/seal.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ if seal and seal.generate_ui ~= 0 then
local res = seal:loc_vars(info_queue, card) or {}
t.vars = res.vars
t.key = res.key or t.key
t.set = res.set or t.set
end
else'''
[[patches]]
Expand Down
1 change: 1 addition & 0 deletions lovely/sticker.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if sticker then
res = sticker:loc_vars(info_queue, card) or {}
t.vars = res.vars or {}
t.key = res.key or t.key
t.set = res.set or t.set
end
info_queue[#info_queue+1] = t
else'''
Expand Down
2 changes: 1 addition & 1 deletion src/game_object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2610,7 +2610,7 @@ Set `prefix_config.key = false` on your object instead.]]):format(obj.key), obj.
}
local res = {}
if self.loc_vars and type(self.loc_vars) == 'function' then
-- card is a dead arg here
-- card is actually a `Tag` here
res = self:loc_vars(info_queue, card) or {}
target.vars = res.vars or target.vars
target.key = res.key or target.key
Expand Down
2 changes: 1 addition & 1 deletion version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return "1.0.0~ALPHA-1224b-STEAMODDED"
return "1.0.0~ALPHA-1224c-STEAMODDED"

0 comments on commit b8d3a31

Please sign in to comment.