Skip to content

Adding Cross‐Mod Content

MathIsFun0 edited this page Feb 27, 2025 · 4 revisions

Note: This page is for the refactor branch of Cryptid, which is still in development!

Adding Cross-Mod Content

Cross-mod content files should be contained at the root of your mod's directory, in the file Cryptid.lua or as Lua files within a folder called Cryptid.

They will look like files from the Cryptid lib folder, or something like this:

local joker1 = {
  object_type = "Joker",
  --more code here
}

return {
  init = function(self)
    --this function runs after the file is loaded, but before items are registered
  end,
  items = {
    joker1,
    --this table lists every object that your mod will load from this file
  }
}

There are some special keys that Cryptid adds, which are important for both gamesets and Cryptid compatibility:

Gamesets

gameset_config: A table containing specific replacements to the config (i.e. number values) of a card based on the gameset selected. Example:

gameset_config = {
  modest = {disabled = true}, --When disabled, the card will be disabled when this gameset is selected.
  mainline = {center = {rarity = 2, cost = 4, blueprint_compat = false}}, --Values in center will modify the center directly. If you're using this, it's important to define these values for every gameset the card is enabled in.
  madness = {extra = {chips = 100}, center = {rarity = 3, cost = 6, blueprint_compat = true}} --Other keys will modify the card's config.
}

extra_gamesets: A table containing a list of strings (these would be keys in gameset_config) for additional gamesets to display in the config menu.

dependencies: A table containing a list of items and/or mods that your item depends on. Example:

dependencies = {
  items = {
    "j_cry_m",
    "set_cry_m", --content sets the card is in should be added here
  },
  mods = {
    "CardSleeves", --these should use Mod IDs, not prefixes or names
    "MoreFluff",
  }
}

conflicts: A table containing a list of mods that your item conflicts with (i.e. should be disabled with)

take_ownership: When true, Cryptid will take ownership of an existing card from your mod with the parameters you give it. Use object_type and a non-prefixed key for Cryptid to find your item.

Unredeeming Vouchers

The spectral Trade requires having the ability to unredeem Vouchers. If you create a Voucher that uses a redeem function, add an unredeem function so Trade can properly reset the changes made by your Voucher.

Applying Editions

Some editions also can call functions for you to customize their effects on your specific object:

Glitched - apply_glitched(self, card, func)

Oversaturated - apply_oversat(self, card, func)

func is a function that takes a number as input and applies the edition's effect onto it.

Disabling Features

If some features may cause too much balance or instability when applied to your object, there are ways to disable certain interactions. Set these values to true in your object in order to apply these effects:

no_doe: This object will not appear in the shop with the Deck of Equilibrium or the Balanced Sleeve, and will not appear from consumable generators (Hammerspace, Doodle M, etc.).

  • Note: Currently, the only way to do this for custom consumable types is to apply this to every consumable

no_grc: This object will not appear from consumable generators. (hidden objects are automatically excluded, except for CCD Deck)

no_aeq: This Joker cannot be generated by Ace Aequilibrium.

no_orb: (Must be added to the boss table) This Blind will not be applied by Obsidian Orb.

no_dbl: This object cannot become part of a Double-Sided card.

immutable: This Joker cannot have its values scaled infinitely by ://MULTIPLY, Gemini, Chemach (from Jen's Almanac), etc.

To apply these mid-run, set G.GAME[feature_key][center_key] to true (e.g. G.GAME.no_doe.j_jolly). Note that G.GAME[feature_key] is not created by default.

Modifications to Cryptid

These tables are created when the game is initialized and can be modified to add your own content.

Cryptid.aliases: An index of aliases used by POINTER://. Keys are the aliases, and values are the original names or IDs of objects POINTER:// should generate.

Object Types

Add pools = {key = true} to add content to these object pools.

Food: Food Jokers

Meme: Jokers that appear in Meme Packs

Tier3: Tier 3 Vouchers

M: M Jokers

Talisman Compat

Cryptid requires Talisman in order to be used. However, large numbers created by Talisman cannot be compared with regular numbers. To do this, you must modify any comparisons with variables related to scoring that Talisman uses large numbers for. For instance, change G.GAME.chips >= G.GAME.blind.chips to to_big(G.GAME.chips) >= to_big(G.GAME.blind.chips).

Compatibility with specific Jokers:

Digital Hallucinations: Add the following to your pack definitions:

cry_digital_hallucinations = {
  colour = HEX("14b341"), --The message color to be displayed
  loc_key = "cry_plus_code", --Localization key for the message to be displayed
  create = function() --The function that adds the card to your run (example here for Program Packs)
    local ccard = create_card("Code", G.consumables, nil, nil, nil, nil, nil, "diha")
    ccard:set_edition({ negative = true }, true)
    ccard:add_to_deck()
    G.consumeables:emplace(ccard)
  end
}