-
Notifications
You must be signed in to change notification settings - Fork 12
04. Global Definitions
Global definitions are run independently of what Jokers you have. Each global definition type has it's own field on the Global_Definitions table.
Define a new global definition as follows:
local jd_global_def = JokerDisplay.Global_Definitions
-- To add a Replace definition
jd_global_def.Replace["your_key_here"] = {
-- Definition
}"your_key_here" should be a unique key for that field to not get overwritten by other mods, so it's recommended that you start all your keys with your mod's Steamodded prefix. Unlike other definitions the exact key value is not important.
Used to replace display text on displays.
NOTE: This will not replace existing displays automatically unless the game is reloaded. To do it manually you can use JokerDisplay.update_all_joker_display(false, true). This will change in the future.
The Replace definition table is composed by the following values:
-
priority: (number) The priority in which replacements are done, higher values are given more priority. Right now, the valid Replace definition with the higher priority gets loaded entirely and the other definitions are dismissed even if the current definition doesn't use all the fields. -
replace_text,replace_reminder,replace_extra: (table|string|function) Replaces the respective field by a given object. The object can either be a table with the normal field definitions (see the Joker definition docs), a string specifying a key in JokerDisplay.Definitions where the respective definition is stored or a function that returns either of the previous types. In particular, you can use{}to delete all values in the display. -
replace_debuff_text,replace_debuff_reminder,replace_debuff_extra: (table|string|function) Same as the fields above but for the debuff display. -
replace_modifiers: (table|string|function) This field will act similar to the fields above in the future, but for now any valid value (like{}) hides the modifiers. -
stop_calc: (boolean) Set totrueif you want to stop the Joker's calculations (use if you replace all the values). -
is_replaced_func: (function) Function that returns true if the replacement should take place.
This global definition field doesn't get used in vanilla Balatro but you can find some examples in Lobotomy Corporation's support.
-- Lobotomy Corporation's Censored
-- Replaces all displays with the word "CENSORED" in red (specified in JokerDisplay.Definitions)
JokerDisplay.Global_Definitions.Replace["lobc_censored"] = {
priority = 1,
replace_text = "lobc_other_censored",
replace_reminder = {},
replace_extra = {},
replace_modifiers = {},
replace_debuff_text = { { text = "CENSORED", colour = G.C.UI.TEXT_INACTIVE } },
stop_calc = true,
is_replaced_func = function (card, custom_parent)
return next(SMODS.find_card("j_lobc_censored")) and card.config.center.key ~= "j_lobc_censored"
end
}-- Lobotomy Corporation's Information challenge
-- Deletes all information on the displays after ante 3.
JokerDisplay.Global_Definitions.Replace["lobc_yesod"] = {
priority = 10,
replace_text = {},
replace_reminder = {},
replace_extra = {},
replace_modifiers = {},
replace_debuff_text = {},
replace_debuff_reminder = {},
replace_debuff_extra = {},
stop_calc = true,
is_replaced_func = function (card, custom_parent)
return G.GAME and G.GAME.modifiers.lobc_yesod and G.GAME.round_resets.ante > 3
end
}