Balatro
You are viewing a potentially older version of this package. View Latest Version
Install

Details

Date Uploaded
4 days ago
Downloads
56
Size
21KB
Dependency string
ThePotatoPatch-Potato_Patch_Utils-1.0.16

Potato-Patch-Utils

A util library for mods created by the Potato Patch with the explicit intent of being used for events run by the group

What functionality does this mod add?

Automatic File Loading

PotatoPatchUtils.load_files(path, blacklist) Will automatically load all .lua files within the passed in path (will typically be SMODS.current_mod.path)

  • path (string) [REQUIRED] - The file path the file loader will start at. Will automatically open folders and load files within them as well
  • blacklist (table) - A table of strings of file names that should be ignored on file loading (file extension, i.e. .lua must be included)

Developer and Team objects

These objects are used for credits and calculating contexts outside of a traditional game object PotatoPatchUtils.Team(args) args is a table of the following values:

  • name (string) [REQUIRED] - The name of the Team
  • colour (colour/gradient) - The Team name's text fill colour
  • loc (string/boolean) - Assigns the Team's display name to a localization key of your choosing from descriptions.PotatoPatch. Will be assigned to 'PotatoPatchTeam_' .. args.name if a boolean is passed
  • calculate (function(self, context)) - A traditional calculate function, much like global mod calculate from Steamodded
  • credit_rows (table) - How many developer objects to display on each row (credit screen has 2 rows, a table of 1 number will center the row in the page)
  • short_credit (boolean) - Setting this to true will change the team credit template text from 'Created by team ' to 'Created by '
PotatoPatchUtils.Team {
  name = 'Example Team',
  colour = HEX(ffffff),
  loc = true, -- Can also be `loc = 'k_exampleteam_name'` where the string is an arbitrary localization dictionary entry
}

PotatoPatchUtils.Developer(args) args is a table of the following values:

  • name (string) [REQUIRED] - The name of the Developer
  • colour (colour/gradient) - The Developer name's text fill colour
  • loc (string/boolean) - Assigns the Developer's display name to a localization key of your choosing from descriptions.PotatoPatch. Will be assigned to 'PotatoPatchDev_' .. args.name if a boolean is passed
  • calculate (function(self, context)) - A traditional calculate function, much like global mod calculate from Steamodded
  • team (string) - The name of the Team the Developer is a part of
  • atlas (string) - The key of the atlas your credit art will be pulled from
  • pos (table) - A coordinate table for the position of your credit art
  • soul_pos (table) - A coordinate table for the position of your credit art's soul sprite
PotatoPatchUtils.Developer {
  name = 'doofus',
  colour = HEX(000000),
  loc = true, -- Can also be `loc = 'k_doofus_name'` where the string is an arbitrary localization dictionary entry
  team = 'Example Team' -- Must match an already existing Team name
  atlas = 'modprefix_atlas',
  pos = {x = 0, y = 0}
}

Credits

Adding these values to a game object will automatically add Credits to whoever is specified in the object's description box. The format should look something like this: ppu_artist = {'Artist1', 'Artist2'}

If the name of a Developer or Team object are used, the text will use the specified colour of the associated object. For example, if Developer 'Eremel' exists with a colour property and a Joker contains ppu_coder = {'Eremel'}, the text will be coloured in with Eremel's defined colour property

  • ppu_artist (table) - The artist(s) of the Game Object
  • ppu_coder (table) - The coders(s) of the Game Object
  • ppu_team (table) - The team the Game Object was created for

If you wish to add a credit page for each Team present in your mod, add SMODS.current_mod.extra_tabs = PotatoPatchUtils.CREDITS.register_page(SMODS.current_mod) to your mod.

Localization Loading

This feature allows for multiple localization .lua files to be used in one project. This allows for much easier handling of localization files in collaborative efforts

PotatoPatchUtils.LOC.process_loc_text(locPath)

  • locPath (string) [REQUIRED] - A string of the path leading to the root localization folder Creating a folder within the localization folder that has a name that matches a valid localization code will be loaded automatically after running this function
image

Info Menu

A customizeable workflow that allows easy creation of pop-up windows, primarily for use as tutorials

Text for an Info Menu must be defined in a localization file under PotatoPatch = { Info_Menu = { menu_type } }, and will consist of a name and text field. text fields can contain subsequent name and text fields which will make up the pages of a window.

The following is an example of proper localization setup from Stocking Stuffer's tutorial pop-up: image

PotatoPatchUtils.INFO_MENU.create_menu(args) args is a table of the following values:

  • menu_type (string) [REQUIRED] - The user-specified type or name of the menu to create. Must also match a key defined in localization
  • back_func (string) - A string that points to the menu's callback function. Defaults to exit_overly_menu
  • page (int) - The page of the menu that will be opened on call. Defaults to 1
  • image (sprite) - A sprite that is to be displayed at the top of the menu
  • vars (table) - A table of values to pass into as localization variables
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.