-
Notifications
You must be signed in to change notification settings - Fork 178
SMODS.Booster
N edited this page Apr 20, 2026
·
18 revisions
Class prefix: p
-
Required parameters:
-
key, -
loc_txtor localization entry (reference)-
loc_txtcan contain an additionalgroup_namestring. This is the bottom text while on the pack opening screen. - With localization files, this text should be stored in
misc.dictionary[group_key or 'k_booster_group_'..key]
-
-
-
Optional parameters (defaults):
-
atlas = 'Booster', pos = { x = 0, y = 0 }, soul_pos, soul_atlas(reference) -
config, discovered = false, no_collection, prefix_config, dependencies, display_size, pixel_size, badge_colour, badge_text_colour(reference)- The default
configtable is{ extra = 3, choose = 1 };extrais the amount of cards in the pack,chooseis the amount of choices. - Note:
unlockedon boosters is currently unsupported.
- The default
-
pools: List of keys to ObjectTypes this center should be injected into- Expects a list of keys like this:
{ ["Foo"] = true, ["Bar"] = true, } -
group_key: Key to the group name (see above) of this booster. Useful when multiple booster packs share the same group name. -
cost = 4, -
weight = 1: Determines how freqently the pack appears in the shop. -
draw_hand = false: If this istrue, draw playing cards to hand when this pack is opened. -
kind: Used for grouping packs together. For example, this can be used inget_pack()to generate a booster pack of a given type. -
select_card:- Set to string of destination card area, ex.
'consumeables', to save cards from the pack instead of using them. - Set to table of form
{Set = 'area'}to change behaviour according to a card'sSet(e.g.{Tarot = 'consumeables'}to only saveTarotcards, relevant if you have multiple types of consumables in a booster). - Set to a function
select_card(self, card, pack) -> string?to control if and wherecardshould be saved for anycard, packcombination.
- Set to string of destination card area, ex.
-
disable_shine: (added in 1531zeebee) Disables the default 'shine' shader.
-
-
loc_vars, generate_ui(reference)- SMODS.Booster implements a default
loc_varsfunction that returnscard.ability.chooseandcard.ability.extra. If your booster pack defines both of these values in itsconfigyou can omit definingloc_vars.
- SMODS.Booster implements a default
-
create_card(self, card, i) -> table|Card- Creates the cards inside of the booster pack.
cardis the booster pack card,iis the position of the card to be generated. If the returned table is not aCard, it is passed intoSMODS.create_card. - Example 1, manual card creation:
-- to create a booster pack of standard cards create_card = function(self, card) local newCard = SMODS.create_card({set = "Playing Card", area = G.pack_cards, skip_materialize = true}) return newCard end,
- Example 2, return passed into
SMODS.create_card:
-- to create a booster pack of foil jokers create_card = function(self, card) return {set = "Joker", area = G.pack_cards, skip_materialize = true, soulable = true, key_append = "unique_string_for_rng", edition = "e_foil"} end,
- Creates the cards inside of the booster pack.
-
update_pack(self, dt)- Handles the booster back's UI elements when this booster is opened.
-
ease_background_colour(self)- Changes the background color whilst this booster is opened.
-
particles(self)- Handles adding particle effects.
-
create_UIBox(self) -> table- Returns the booster's UIBox.
-
set_ability(self, card, initial, delay_sprites)- Set up initial ability values or manipulate sprites in an advanced way.
-
in_pool(self, args) -> bool, { allow_duplicates = bool }- Define custom logic for when a card is allowed to spawn. A card can spawn if
in_poolreturns true and all other checks are met. -
allow_duplicatesallows this card to spawn when one already exists, even without Showman. - When called from
get_current_pool, the_appendkey is passed asargs.source.
- Define custom logic for when a card is allowed to spawn. A card can spawn if
-
get_weight(self) -> number- Returns weight. Use for finer control over the booster's weight.
-
update(self, card, dt)- For actions that happen every frame.
-
set_sprites(self, card, front)- For advanced sprite manipulation that happens when a card is created or loaded.
-
load(self, card, card_table, other_card)- For modifications to sprites or the card itself when a run is reloaded.
-
set_badges(self, card, badges)- Add additional badges, leaving existing badges intact. This function doesn't return; add badges by appending to
badges. - Avoid overwriting existing elements. It will cause text to appear on the top left corner of your screen instead.
- Function for creating badges:
create_badge(_string, _badge_col, _text_col, scaling)-
_string: Text displayed on the badge. -
_badge_col = G.C.GREEN: Background colour. -
_text_col = G.C.WHITE: Text colour. -
_scaling = 1: Relative size of the badge.
-
- Example:
{ set_badges = function(self, card, badges) badges[#badges+1] = create_badge(localize('k_your_string'), G.C.RED, G.C.BLACK, 1.2 ) end, } - Add additional badges, leaving existing badges intact. This function doesn't return; add badges by appending to
-
set_card_type_badge(self, card, badges)- Same as
set_badges, but bypasses creation of the card type / rarity badge, allowing you to replace it with a custom one.
- Same as
-
draw(self, card, layer)- Draws the sprite and shader of the card.
-
SMODS.Booster:take_ownership_by_kind(kind, obj, silent)- Finds all booster packs with matching
kindand callsSMODS.Booster:take_ownership()for each one with argumentsobj, silentpassed through.
- Finds all booster packs with matching
Game Objects
- API Documentation
- SMODS.Achievement
- SMODS.Atlas
- SMODS.Attribute
- SMODS.Blind
- SMODS.CanvasSprite
- SMODS.Center
- SMODS.Challenge
- SMODS.DeckSkin
- SMODS.DrawStep
- SMODS.DynaTextEffect
- SMODS.Font
- SMODS.Gradient
- SMODS.https
- SMODS.JimboQuip
- SMODS.Keybind
- SMODS.Language
- SMODS.ObjectType and SMODS.ConsumableType
- SMODS.PokerHand
- SMODS.Rank and SMODS.Suit
- SMODS.Rarity
- SMODS.Scoring_Parameter and SMODS.Scoring_Calculation
- SMODS.Seal
- SMODS.Shader and SMODS.ScreenShader
- SMODS.Sound
- SMODS.Stake
- SMODS.Sticker
- SMODS.Tag
Guides
- Your First Mod
- Mod Metadata
- The Mod Object
- Calculate Functions
- Perma-bonuses
- Object Weights
- Logging
- Event Manager
- Localization
- Text Styling
- UI Structure
- Utility Functions
- All About
G - Internal Documentation
Release Notes
Found an issue, or want to add something? Submit a PR to the Wiki repo.