Skip to content

Optimize quantum enhancements's set_ability#1322

Merged
Aurelius7309 merged 6 commits intoSteamodded:mainfrom
SleepyG11:quantum_set_ability
Apr 10, 2026
Merged

Optimize quantum enhancements's set_ability#1322
Aurelius7309 merged 6 commits intoSteamodded:mainfrom
SleepyG11:quantum_set_ability

Conversation

@SleepyG11
Copy link
Copy Markdown
Collaborator

@SleepyG11 SleepyG11 commented Apr 8, 2026

This PR targeted to optimize quantum enhancements by providing Card.quantum_set_ability function, which works mostly the same as Card.set_ability but without any kind of resizing or sprite manipulations.

As a result, calculating time for 80 steel cards in hand + 2 jokers with quantum effect was decreased from 8 seconds to 3 seconds. Additionally, it significantly decreases a lag during selecting cards in hand + hovering them.

Sadly, because by patching Card:set_ability will be difficult to exclude all side effects, new method was used, which leads to some noticeable changes from previous implementation:

  • all hooks and patches targeted to Card:set_ability will not be reflected in Card.quantum_set_ability
  • if during SMODS.Center.set_ability some changes to card outside of ability table is made, they will persist. Modders can check card.from_quantum to account for this behaviour.
  • SMODS.calculate_context({setting_ability = true}) will not be called between switching quantum enhancements. Maybe it's a good thing?

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.

@SleepyG11 SleepyG11 changed the title Quantum set ability Quantum set ability (optimization) Apr 8, 2026
@SleepyG11 SleepyG11 changed the title Quantum set ability (optimization) Optimize quantum enhancements's set_ability Apr 8, 2026
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.

2 participants