BasicButtons

v0.1.4·Updated 2026-10-07

Adds Use buttons to Jokers, and allows defining custom buttons.

About this mod Author’s original text

Basic Buttons

An API to give your Jokers buttons and modify the default ones.

This code was adapted from SynthB, which in turn adapted it from Spectrallib. The idea is to make it easy to use for people who only have something simple in mind, but at the same time modular enough that people who do have something complex in mind can implement it.

How to use in your mod

To access the API, you can either add Basic Buttons as a dependency for your mod, or you can clone buttons.lua from this repository and load it unmodified. If you pick the latter option, please add Basic Buttons with its current version number to the "provides" list in your mod's metadata. (Example) You may also benefit from adding lsp_defs.lua to your workspace; it's not required for function, but it lets your Lua Language Server provide hints and validation.

(Note users, this is based on Steamodded's dependency logic only, idk whether provides actually works like that with their mod managers. Or exists at all, actually.)

If you just want usable Jokers and nothing complicated:

Give your Joker a use(self, card) field that performs its function. You may also give it a can_use(self, card):boolean field that determines when the use button works; if the field is not defined the Joker will be usable at any time the player is able to use cards at all.

You may also define functions that conditionally hide the use and sell buttons, hide_use_button(self, card):boolean and hide_sell_button(self, card):boolean. Though obviously hiding the use button doesn't do anything on Jokers which never had one defined!

If you want something complicated:

Give your Joker a buttons field, consisting of a table of tables, each with two fields:

local button = {

get_button_args = function(self, card)

--Returns a set of arguments, as defined below. This can be dynamic, if you like; it will be reevaluated each time the Joker is highlighted. Returning nil hides the button.

end,

hide = function(self, card)

--If this function exists and returns true, the button will not be rendered.

end

}

Each button is another table.

Cards can only display 5 buttons in total (including the vanilla sell button); it's _already_ getting cramped by that point! If there are more eligible buttons on a Joker at a time than that, a random selection of 5 will be displayed each time the card is clicked.

That said, it's probably ideal for modders to just... _not_ give their Jokers that many buttons at once. That's so many buttons, y'all.

Button arguments

local args = {

id = string, --To identify this button, in case another button wants to override it.

override = string, --The id of a button this button will replace; generally "use" or "sell", but you can override any button you like.

effect = string, --Name of a function(e) in G.FUNCS that is run when this button is pressed. In these functions, e.config.ref_table refers to the card argument below.

can = string, --Name of a function(e) in G.FUNCS that runs every frame the card is selected. Generally used to conditionally modify e.config; see the default can_use function in buttons.lua for an easy example.

one_press = boolean, --This button disables itself when pressed. Used by the vanilla sell button to prevent spam-clicking shenanigans.

title = string, --Title of the button, in small text above the main text (e.g. "Sell" on the vanilla sell button).

title_colour = table, --The color to render the title in; find colors in G.C or use HEX(). Defaults to G.C.WHITE.

title_scale = number, --Size of the text to be rendered. Defaults to 0.4 in this context.

bg_colour = table, --Color of the button's background when it can be pressed. Defaults to G.C.ORANGE.

bg_colour_inactive = table, --Color of the button's background when it can not be pressed. Defaults to G.C.UI.BACKGROUND_INACTIVE.

handy_insta = string, --Defines what insta-action Handy performs on this card? ngl i don't actually know what this string refers to, but if you do, you can def

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
  3. For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
  4. Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.

Install locations vary a lot between mods — the bundled readme is the most reliable guide. These mods need a community loader first — the bundled readme usually points to its download.

Dependencies

Install these first, or the mod will not work:

Steamodded-Steamodded

File & checksum

Filename
BasicButtons-0.1.4.zip
File size
87.2 KiB