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:
funman300
2026-07-14 14:03:35 -07:00
parent 2c47449b13
commit a2d16ae12f
5 changed files with 181 additions and 1 deletions
+16 -1
View File
@@ -13,7 +13,7 @@ and pulses strongly recommended cards. Pure Lua, no build step.
Syntax check, then run the test suite — **always both, after every edit**:
```sh
luac -p main.lua synergies.lua config.lua test.lua
luac -p main.lua synergies.lua config.lua integrations.lua test.lua
lua test.lua
```
@@ -192,6 +192,21 @@ Three-layer split; `JCA` is the single global namespace:
- `config.lua` — default settings (`pulse`, `owned_tooltip`, `threshold`).
Steamodded loads and persists this table itself; read it only via
`SMODS.current_mod.config` (exposed as `JCA.config`).
- `integrations.lua` — cross-mod integrations, loaded at the very end of
`main.lua` (pcall-wrapped; counts land in `JCA.integrations`). Every
integration gates on its target's global — a missing mod is silence — and
both targets load before us (JokerDisplay priority -1e9, TMJ -1000, ours 0):
- **JokerDisplay**: appends a `(2 combos)` counter element to each known
joker's `reminder_text` (created when absent) and wraps the definition's
`calc_function` to fill `card.joker_display_values.jca_combos` from
`partners_for`. The wrapper pcalls the original calc and blanks the text
when `config.jd_combos` is off, so the toggle works mid-run both ways.
Definitions are marked `jca_combo_counter` against double patching.
- **Too Many Jokers**: registers a `TMJ.SEARCH_FIELD_FUNCS` entry (its
api.md's documented hook) returning the joker's `TAG_LABEL`s on both
sides, so the collection search finds jokers by 'money', 'Hearts',
'held-card retriggers'... Unknown centers return nil, never an error.
The smoke scenario asserts the JokerDisplay patch against the real mod.
## Conventions and gotchas