Integrate with the mods actually installed beside us
New integrations.lua, loaded pcall-wrapped at the end of main.lua; every integration gates on its target's global so a missing mod is silence. Both targets load before us by priority. JokerDisplay: each known joker's display definition gains a live '(2 combos)' counter in JD's own parenthetical reminder style -- the same partner count the hover tooltip names -- by appending a dynamic element to reminder_text (created when absent) and wrapping calc_function to fill card.joker_display_values. The wrapper pcalls the original calc and blanks the text when the new jd_combos config toggle is off, so it flips mid-run in both directions. Too Many Jokers: registers the SEARCH_FIELD_FUNCS hook its api.md documents, indexing every joker under its tag labels on both sides, so the collection search finds jokers by 'money', 'Hearts', 'held-card retriggers'. Unknown centers stay nil. The smoke scenario now asserts the JokerDisplay patch against the real mod: 13/13 in-game. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1613,6 +1613,12 @@ if SMODS.current_mod then
|
||||
ref_table = JCA.config, ref_value = 'touch_mode',
|
||||
},
|
||||
}},
|
||||
{n = G.UIT.R, config = {align = 'cm', padding = 0.05}, nodes = {
|
||||
create_toggle{
|
||||
label = 'Combo counter under jokers (JokerDisplay)',
|
||||
ref_table = JCA.config, ref_value = 'jd_combos',
|
||||
},
|
||||
}},
|
||||
{n = G.UIT.R, config = {align = 'cm', padding = 0.05}, nodes = {
|
||||
create_option_cycle{
|
||||
label = 'Recommendation threshold (lower = more picks)',
|
||||
@@ -1625,3 +1631,27 @@ if SMODS.current_mod then
|
||||
}}
|
||||
end
|
||||
end
|
||||
|
||||
-- Cross-mod integrations -------------------------------------------------------
|
||||
-- integrations.lua patches JokerDisplay (combo counter under jokers) and Too
|
||||
-- Many Jokers (search the collection by synergy tags) when they are present.
|
||||
-- pcall on the whole load: a partner mod's surprise API change must degrade
|
||||
-- to a log line, never take the advisor down with it.
|
||||
|
||||
do
|
||||
local loaded, integrations = pcall(function()
|
||||
return assert(SMODS.load_file('integrations.lua'))()
|
||||
end)
|
||||
if loaded and integrations then
|
||||
JCA.integrations = {}
|
||||
for name, apply in pairs(integrations) do
|
||||
local ok, count = pcall(apply)
|
||||
JCA.integrations[name] = ok and count or 0
|
||||
if not ok then print('JCA: integration ' .. name .. ' failed: ' .. tostring(count)) end
|
||||
end
|
||||
dbg('integrations:', (JCA.integrations.jokerdisplay or 0) .. ' JokerDisplay defs,',
|
||||
(JCA.integrations.toomanyjokers or 0) .. ' TMJ search hooks')
|
||||
else
|
||||
print('JCA: integrations failed to load: ' .. tostring(integrations))
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user