SMODS.ObjectType#
Required parameters:
keyUnlike other game objects, ObjectTypes don’t add your mod’s prefix automatically to the key to allow multiple mods to share pools. You can still add your prefix manually to avoid conflicts.
Optional parameters (defaults):
prefix_config, dependencies(reference)default: Fallback card when object pool is emptycards: List of keys to centers to auto-inject into this ObjectTypeExpects a list of keys like this:
{ ["j_foo_joker"] = true, ["c_bar_tarot"] = true, }
raritiesallows cards to show up at different rates.Expects a list of tables like this:
{ key = '', rate = 0.5, }
The sum of all rates is normalized internally, so you don’t need to concern yourself with making these values add up to
1. Not defining a rate will use the default rate assigned by the rarity.
SMODS.ConsumableType#
This is a subclass of SMODS.ObjectType. All values and functions tied to SMODS.ObjectType work for this class.
Required parameters:
keyLike with ObjectTypes, ConsumableTypes don’t add your mod’s prefix automatically to the key. You can still add your prefix manually to avoid conflicts.
primary_coloursecondary_colour
Optional parameters (defaults):
no_collection(reference)loc_txt, Skeleton:
{
name = '', -- used on card type badges
collection = '', -- label for the button to access the collection
undiscovered = { -- description for undiscovered cards in the collection
name = '',
text = { '' },
},
}
-- In localization files:
-- name should be under should be under `G.localization.misc.dictionary['k_'.. key:lower()]`
-- the badge label under `G.localization.misc.labels[key:lower()]`
-- collection under `G.localization.misc.dictionary['b_'.. key:lower().. '_cards']`
-- undiscovered under `G.localization.descriptions.Other['undiscovered_'.. key:lower()]`
collection_rows = { 6, 6 }: Customize the collection for this card type. Each value indicates a row with the specified amount of cards.shop_rate: Setting a numerical value forshop_rateenables cards of this type to appear in the shop at the specified rate.This sets a default rate, which can be modified by accessing
G.GAME[key:lower() .. '_rate']during a run.
text_colour: Set a custom text color used on the card type’s badge. This can take any HEX color, and saves it asG.C.UI[key].select_card:Set to string of destination card area, ex.
'consumeables', to save cards of this type from Booster packs instead of using it.Set to a function
select_card(card, pack) -> string?, boolean?to control if and wherecardshould be saved for anycard, packcombination. (Added in 1814a) Returningtrueas the second value allows the player to select whether to save or use the card.Takes priority over
select_cardon the Booster pack
API methods#
ObjectType.inject_card(self, center)Used for modifying any registered cards of this type, or adding them to additional pools.
ObjectType.delete_card(self, center)Used for removing cards from additional pools when deleted.
ObjectType.set_badges(self, card, badges)(Added in 1814a)
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,
}
ConsumableType.create_UIBox_your_collection(self) -> tableReturns the UIBox of the ConsumableType’s collections menu.
SMODS.UndiscoveredSprite#
For consumable types, a sprite for undiscovered objects can be registered. Otherwise, the default undiscovered Joker sprite is used. The keys of both objects should match exactly. Remember to use prefix_config.atlas = false if you want to reference an atlas from the base game.
Required parameters:
keyatlaspos
Optional parameters:
prefix_config, dependencies(reference)no_overlay: disables the floating ? sprite from undiscovered objectsoverlay_pos: customize the floating ? sprite using your atlas. Expects{x = 0, y = 0}