Files
Bubberstation/code/modules/cards
Mothblocks ad929ac3a9 Lazily initialize decks of cards instead of initializing thousands of cards at once (.09s drop in init times) (#70999)
We're getting into the less than 0.1s realm of low hanging fruits now.

Decks of cards were initializing thousands of cards at once, not unlike
[paper bins](https://github.com/tgstation/tgstation/pull/69586) or
[circuit components](https://github.com/tgstation/tgstation/pull/69664).

Cards are more complicated than paper bins since we can't just keep a
count, and managing individual card object lifetimes is significantly
more complicated than incrementing/decrementing a number. Thus, the
logic here is slightly different.

Decks now have an `initial_cards` variable which can take card names
(which is most implementers), and for special decks, can specify an
interface that is basically a lazy function for creating a card atom.

When anything needs any real card atom, we just generate them all. The
runtime cost of this is extremely small, and affects neither dev cycles
(the motivation for the change) or ongoing rounds.
2022-11-22 08:21:29 +01:00
..