Skip to content

Conversation

@VivianGiacobbi
Copy link
Contributor

Expands the save_with_action() function that has limited use in vanilla. Originally, it's only used to save opening Booster Packs, and is hardcoded to call G.FUNCS.use_card. Now, it can be generally applied to any card action/function, which can be helpful for more advanced modded card types.

  • Handling for save_with_action() on reload correctly uses type property passed in to call the keyed function
  • New save_with_action() arguments
    • args table argument: saved and then unpacked to call the type function on reload (NOTE: this applies the second argument onwards. The first argument remains a dummy table {config = {ref_table = action_card}} to represent the action card)
    • highlights table argument: a table of sort_id maps to rehighlight cards in relevant cardareas on reload (since many consumables require them)
  • Added SMODS.save_action_highights(cardareas) utility function to help create the highlights argument above
    • If cardareas is nil, it will save all highlighted cards in global table cardareas. Otherwise, cardareas is a map of string keys
  • Added SMODS.action_nosave value so you don't have to redeclare vanilla functions with similar nosave arguments to G.FUNCS.use_card when hooking or patching

Additional Info:

  • I didn't modify api's or I've made a PR to the wiki repo.
  • I didn't modify api's or I've updated lsp definitions.
  • I didn't make new lovely files or all new lovely files have appropriate priority.

@VivianGiacobbi VivianGiacobbi changed the title Save actions Better Save Actions Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant