You are viewing a potentially older version of this package. View all versions.
JoStro-JSUtils-0.3.0 icon

JSUtils

Lets mods add item prototypes, descriptions and custom sprites with simple json configuration files

Date uploaded 3 weeks ago
Version 0.3.0
Download link JoStro-JSUtils-0.3.0.zip
Downloads 490
Dependency string JoStro-JSUtils-0.3.0

This mod requires the following mods to function

Thunderstore-lovely-0.4.0 icon
Thunderstore-lovely

Lovely is a runtime lua injector for LÖVE 2d

Preferred version: 0.4.0
metherul-nativefs-1.0.1 icon
metherul-nativefs

nativefs replicates a subset of the love.filesystem API, but without LÖVE's path restrictions.

Preferred version: 1.0.1
JoStro-json5-0.1.1 icon
JoStro-json5

Exposes a module for parsing json5 using lovely

Preferred version: 0.1.1

README

JSUtils: A configuration framework for Balatro

JSUtils is a mod that allows mods to define additional item prototypes, item descriptions and sprite atli using a collection of json configuration files. Additional patches for giving items custom atli and correctly adding items into the collection pages are also included.

Usage

The JSON configuration files must be placed directly in a folder named js_utils inside of the appropriate mod's folder. These configuration files also support all the extensions provided by json5.

The following files are supported:

  • centers.json, blinds.json, tags.json and seals.json: Each contain a table that is added to the appropriate item prototype table in Game:init_item_prototypes, for example centers.json is added to G.P_CENTERS.
  • descriptions.json: contains a table of various custom localizations that are added to the descriptions section of the game's localization object. en-us is required as it is defaulted to when a language is not included.
  • misc_loc.json: Behaves the same as descriptions.json for the misc section of the localization.
  • asset_atli.json, animation_atli.json: Each contain a list of atlas objects, that are inserted directly into the appropriate lists in Game:set_render_settings. Paths are extrapolated to be relative to <mod_dir>/textures/{1,2}x
  • badge_colours.json: Contains a table connecting localization label keys to colours, the game's built in colour names can be provided as strings as can hex codes.

Examples

A basic joker added in centers.json. order is modified to be relative to the current mod or is set automiatically, and pos is defaulted to {x = 0, y = 0} when none is provided. Here we are also using the atlas and badges properties to use a custom atlas and add a custom "example" badge.

{
  j_example_joker: {
    order: 1, // relative to any other jokers in this file
    name: "Example Joker",
    unlocked: true,
    discovered: true,
    blueprint_compat: true,
    eternal_compat: true,
    rarity: 1,
    cost: 2,
    set: "Joker",
    effect: "",
    cost_mult: 1.0,
    config: {},
    atlas: "Example", // Custom atli can be provided with the atlas field
    badges: [ // Joker specific badges can be provided here
      "example",
    ],
  },
}

A simple english joker description added in descriptions.json.

{
  "en-us": { // keys that contain certain characters such as dashes must be quoted
    Joker: {
      j_example_joker: {
        name: "Example Joker",
        text: [
          "Does nothing special",
          "but it's a mod so that's cool",
        ],
      },
    },
  },
}

A custom atlas added in asset_atli.json, requires a file called example.png located in textures/1x and textures/2x in the mod's folder

[
  {name:"Example",path:"example.png",px:71,py:95},
]

The localization for the custom badge "example" in misc_loc.json

{
  "en-us": {
    labels: {
      example: "Just an Example",
    },
  },
}

and the colour for that badge in badge_colours.json

{
  example: "BLACK" // keys inside of G.C are supported
}

CHANGELOG

Version 0.3.0

  • Change config format to json5 (fully backwards compatible with json)
  • Add options to facilitate the creation and usage of custom badges.
  • The following additional config files are supported: misc_loc.json, badge_colours.json

Version 0.2.1

  • Bump Dependency Versions

Version 0.2.0

  • Added support for the order field, modifying it to be relative to the current mod.