BasicButtons

版本 v0.1.4·更新於 2026-10-07

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

模組介紹 作者原文

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

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。 這類模組需要先安裝社群載入器(包內 readme 通常會提供下載入口)。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

Steamodded-Steamodded

檔案與校驗

檔案名稱
BasicButtons-0.1.4.zip
檔案大小
87.2 KiB