
Cosmetics API
Developer library to simplify adding new cosmetics to Hades II. Allows adding variants of existing cosmetics, new card back packs, Chthonic Chids, familiar skins and even turning any obstacle into a cosmetic with variants. Does nothing by itself.Cosmetics API
Developer library to simplify adding new cosmetics to Hades II. Allows adding variants of existing cosmetics, new card back packs, Chthonic Chids, familiar skins and even turning any obstacle into a cosmetic with variants. Does nothing by itself.
Features
Through this library, you can easily add new cosmetic items to the Crossroads, as offered by Dora. You can add alternative versions of any existing cosmetic, or turn any Crossroads obstacle into a cosmetic with variants (including mod-spawned obstacles). You can also add new Arcana Card Back packs, Chthonic Chids and Familiar Skins.
Please see the relevant sections below for how to add each type of cosmetic.
The library will automatically handle grouping cosmetics so that equipping one will unequip any other already equipped cosmetic in the same group. You can provide names, descriptions and flavour texts for various languages, as well as customize the voicelines used when purchasing, equipping or unequipping the cosmetic.
For even more advanced usecases, you can also provide a function name that is called when your cosmetic is bought or equipped.
Usage
Start by adding NikkelM-Cosmetics_API as a dependency in your thunderstore.toml (ensure you use the latest version):
NikkelM-Cosmetics_API = "1.1.4"
Next, include the Cosmetics API in your main.lua, alongside other dependencies:
---@module "NikkelM-Cosmetics_API"
CosmeticsAPI = mods["NikkelM-Cosmetics_API"]
Registering Packages
If your cosmetics use custom textures bundled in .pkg files, you can register those packages so the API loads them when entering the Crossroads.
Place your .pkg (and .pkg_manifest) files in your mod's plugins_data folder and call RegisterCrossroadsPackages with a table of package names (without the .pkg extension):
CosmeticsAPI.RegisterCrossroadsPackages({ "AuthorName-ModNameCosmetics" })
The API will automatically load all registered packages when the player enters the Crossroads (including the Training Grounds), regardless of which transition is used (DeathAreaRoomTransition, HubPostBountyLoad, or HubPostDreamLoad).
Duplicate package names are silently ignored.
You can alternatively also load the packages yourself within your mod code.
Registering Cosmetics
Now, you can add a new cosmetic by calling CosmeticsAPI.RegisterCosmetic(cosmeticData), where cosmeticData is of type CosmeticData.
If you have your development environment set up correctly, VS Code should offer autocompletion and type hints for this table.
Otherwise, you can always refer to the def.lua file in the Cosmetics API source, or the below example, for all available fields.
CosmeticsAPI.RegisterCosmetic({
-- REQUIRED FIELDS
Id = _PLUGIN.guid .. "." .. "Cosmetic_Pillars_Chronos",
-- At least "en" must be provided for Name, Description and FlavorText
Name = {
en = "Pillars, Timeless",
de = "...",
},
Description = {
-- "{$Keywords.CosmeticSwap}:" resolves to "Alt Decor" with a tooltip for something that replaces something, "{$Keywords.CosmeticAltAdd}:" to "Extra Decor" with a tooltip that it adds or replaces something similar, and {$Keywords.CosmeticAdd} resolves to "Extra Decor" for something that did not exist before. Use CosmeticAdd only for new cosmetic obstacles spawned by your mod that define a new group through CreateCosmeticsGroup.
en = "{$Keywords.CosmeticSwap}: Time-worn monoliths that stand tall to either side of the {#BoldFormatGraftDark}Cauldron{#Prev}.",
de = "...",
},
FlavorText = {
en = "Nothing stands the test of time they say, yet these pillars beg to differ.",
de = "...",
},
-- Which of Dora's shop locations to add this cosmetic to. One of "CosmeticsShop_Tent" (Mel's Tent), "CosmeticsShop_Main" (Crossroads Main Grounds & West), "CosmeticsShop_Taverna" (Taverna & Crossroads West), "CosmeticsShop_PreRun" (Training Grounds)
ShopCategory = "CosmeticsShop_Main",
-- Which existing cosmetic the new one is a variant of
CosmeticsGroup = "Cosmetic_CauldronPillars01",
-- The in-world asset when the cosmetic is equipped
CosmeticAnimationPath = "AuthorName-ModName\\FolderPath\\Pillars_Chronos",
-- You can often reuse your animation path asset as an icon if you scale it correctly, though the icon might look grainy and be harder to decipher if the cosmetic is detailed
IconPath = "AuthorName-ModName\\FolderPath\\Pillars_Chronos_Icon",
-- OPTIONAL FIELDS (with their defaults)
AnimationScale = 1,
AnimationInheritFrom = nil,
AnimationOffsetX = 0,
AnimationOffsetY = 0,
IconScale = 1,
IconOffsetX = 0,
IconOffsetY = 0,
-- Which other cosmetic in the same shop category to insert your new one after, or nil to add to the end
InsertAfterCosmetic = nil,
-- Try to limit to a maximum of four resources (including CosmeticsPoints) for optimal display in the UI
Cost = {
CosmeticsPoints = 50,
},
-- Must be met before the cosmetic becomes available for purchase
GameStateRequirements = {},
-- Note: some field validations performed by the API are disabled if you provide this property
InheritFrom = { "DefaultCosmeticItem" },
-- If the new cosmetic can show up in the shop as soon as eligible, even if the shop has already been viewed in the current Crossroads session. Otherwise, will show after the next run
AlwaysRevealImmediately = false,
-- Set to true if this cosmetic creates a new CosmeticsGroup
CreateCosmeticsGroup = false,
-- Unlocks and equips this cosmetic automatically after registration
AutoUnlock = false,
-- Overrides where the camera pans when equipping the cosmetic
CameraFocusId = nil,
-- At least one of SetAnimationIds or ActivateIds must be provided (or inherited by the vanilla cosmetic), use the one the vanilla cosmetic uses!
SetAnimationIds = nil,
ActivateIds = nil,
DeactivateIds = nil,
ToggleCollision = nil,
ActivateFunctionName = nil,
ActivateFunctionArgs = nil,
OnRevealFunctionName = nil,
OnRevealFunctionArgs = nil,
PanDuration = 1,
PreActivationHoldDuration = 0.5,
PostActivationHoldDuration = 1.5,
PreRevealVoiceLines = { ... },
RevealReactionVoiceLines = { ... },
CosmeticRemovedVoiceLines = { ... },
CosmeticReEquipVoiceLines = { ... },
-- If your cosmetic is a new cauldron, you will need to set this to true so the API knows to apply cauldron-specific logic (like handling which cauldron lid the game uses)
IsCauldron = false,
-- Cauldron scaling and location is not changeable through sjson, if your lid is not aligned properly, you will need to change your asset directly
CauldronLidAnimationPath = nil,
})
Creating a new cosmetics group
To create a new cosmetics group, set CreateCosmeticsGroup = true on the first cosmetic registered for the new group.
This cosmetic's Id serves as the group anchor, and others in the group should use it as their CosmeticsGroup key.
It is recommended to set the Id of such a group-creating cosmetic to the vanilla obstacle's animation name, prefixed with with ModCosmetic_, not your mod's GUID, as it should be easily identifiable and deduplicated across mods.
Please consult the CosmeticsAPI wiki first to find out if another mod is also creating a cosmetics group for the same obstacle.
If you create a cosmetics group for a vanilla or mod-spawned obstacle, please consult the CosmeticsAPI wiki for how this can be documented there for other authors to find.
When creating a group with RotateOnly = true, you must also set AutoUnlock = true, as the default for a rotation-only group is always already unlocked/visible.
The game will hide this auto-unlocked cosmetic in the shop until the player buys a variant of the cosmetic, at which point it will become visible so the player can switch back to it.
After registering the cosmetic that creates the new group, you can register variants for it just like you do for vanilla cosmetics.
When creating a cosmetic group for variant cosmetics of a vanilla obstacle, always register its original appearance first using CreateCosmeticsGroup = true, with AutoUnlock = true (to ensure the player already owns the cosmetic for the animation that already exists) and RotateOnly = true (so that the player isn't able to completely remove this group).
Registering the existing animation as a cosmetic ensures that players can always revert to the original appearance, and aren't stuck on your new variant.
For example, the two registrations below turn the "hover" highlight when Melinoë approaches the Altar of Ashes into two cosmetics - the default animation, and a new animation variant.
-- First ensure no other mod has already registered this group creator cosmetic
if not game.WorldUpgradeData["ModCosmetic_Crossroads_CardAltar_Terrain_On01"] then
CosmeticsAPI.RegisterCosmetic({
-- Use the vanilla obstacle's animation name, and prefix it with "ModCosmetic_" instead of your _PLUGIN.guid
Id = "ModCosmetic_Crossroads_CardAltar_Terrain_On01",
Name = {
en = "Tarot Light, Green",
},
Description = {
en = "{$Keywords.CosmeticSwap}: An eery green glow that surrounds the Altar of Ashes when the Princess approaches.",
},
FlavorText = {
en = "A familiar light, kept as it was.",
},
ShopCategory = "CosmeticsShop_PreRun",
InsertAfterCosmetic = "Cosmetic_SkellyFloor01c",
-- If CreateCosmeticsGroup is true, you cannot pass CosmeticsGroup
CreateCosmeticsGroup = true,
AutoUnlock = true,
RotateOnly = true,
-- This is the ID of the vanilla obstacle
SetAnimationIds = { 588748 },
-- This is the path to the vanilla animation texture
CosmeticAnimationPath = "Tilesets\\Crossroads\\Crossroads_CardAltar_Terrain_On01",
-- Use the animation itself as the icon (scaled if needed), or create a new icon for it, since it will show in the shop too
IconPath = "Tilesets\\Crossroads\\Crossroads_CardAltar_Terrain_On01",
})
end
-- After registering the default appearance, you can register additional variants for the new group
CosmeticsAPI.RegisterCosmetic({
Id = _PLUGIN.guid .. "." .. "Cosmetic_TarotLight_Moonlit",
Name = {
en = "Tarot Light, Moonlit",
},
Description = {
en = "{$Keywords.CosmeticSwap}: An eery blue glow that surrounds the Altar of Ashes when the Princess approaches.",
},
FlavorText = {
en = "Selene's influence reaches far and wide.",
},
ShopCategory = "CosmeticsShop_PreRun",
-- Your registered vanilla cosmetic, or another cosmetic in this group
InsertAfterCosmetic = "ModCosmetic_Crossroads_CardAltar_Terrain_On01",
-- The new group you registered above/another mod already registered
CosmeticsGroup = "ModCosmetic_Crossroads_CardAltar_Terrain_On01",
SetAnimationIds = { 588748 },
CosmeticAnimationPath = "AuthorName-ModName\\TarotLight_Moonlit",
IconPath = "AuthorName-ModName\\TarotLight_Moonlit_Icon",
})
If your new cosmetic group is for an obstacle that doesn't exist in vanilla, you must spawn it through your mod yourself and ensure the ObjectIds match.
If you and another mod both want to add variants for the same vanilla obstacle, both mods should agree on a CosmeticsGroup name (preferably the name of the vanilla cosmetic's animation, prefixed with ModCosmetic_), and both should check if the new default cosmetic/the new group already exists (if registered by the other mod first) before attempting to create it.
Do this by checking game.WorldUpgradeData[cosmeticsGroupNameYouAgreedOn], as in the example above.
Registering Card Back Packs
You can add new Arcana card back packs to the Training Grounds cosmetics shop. Each pack unlocks a set of card backs when purchased. The API handles shop display, animation hookup and pagination when the selection screen exceeds one page.
Card backs require four types of textures, in different packages. See the bottom of this section for example textures for each of the four.
| Texture | Per pack or per card? | Used Where | Example path | Package Type |
|---|---|---|---|---|
| DeckArt (idle) | Per card | Card back picker idle animation in the Arcana screen (Three overlayed copies of the card) | GUI\Screens\MetaUpgrade\DeckArt\Deck10 |
RegisterCrossroadsPackages |
| DeckArtMouseover (hover) | Per card | Card back picker hover animation in the Arcana screen (Four spread out copies of the card) | GUI\Screens\MetaUpgrade\DeckArt\DeckMouseover10 |
RegisterCrossroadsPackages |
| IconPath (shop preview) | Per pack | Training Grounds cosmetics shop icon (Three different fanned-out cards from the pack) | GUI\Screens\CosmeticIcons\cosmetic_deckMisc |
RegisterCrossroadsPackages |
| CardBack (in-combat flip) | Per card | During runs when an Arcana is added, e.g. through Judgment (Single straight-aligned copy of the card) | GUI\Screens\CardBack\CardBack10 |
RegisterAlwaysLoadedPackages |
First, register your packages:
-- DeckArt (Idle and Hover, per card) + shop icon (per pack) - only needed and loaded in the Crossroads
CosmeticsAPI.RegisterCrossroadsPackages({ "AuthorName-ModName-DeckArt" })
-- CardBack (per card) - loaded at ALL times (including during runs), keep these packages small
CosmeticsAPI.RegisterAlwaysLoadedPackages({ "AuthorName-ModName-CardBacks" })
Then register a card back pack:
CosmeticsAPI.RegisterCardBackPack({
-- REQUIRED FIELDS
Id = _PLUGIN.guid .. "." .. "MyCardBackPack",
Name = {
en = "Arcana, Modded",
},
Description = {
en = "{$Keywords.CosmeticDeck}: Set of {#UpgradeFormatDark}<Number of cards in this deck> {#Prev}alternate themes, featuring <something about this deck>.",
},
FlavorText = {
en = "Every card tells a story.",
},
-- Shop preview icon - a small thumbnail (110×110 px). See vanilla examples: GUI\Screens\CosmeticIcons\cosmetic_deckMisc
IconPath = "AuthorName-ModName\\Icons\\MyPackIcon",
-- OPTIONAL FIELDS (with their defaults)
IconScale = 1,
IconOffsetX = 0,
IconOffsetY = 0,
Cost = { CosmeticsPoints = 300 },
-- Unlocking Arcana card packs will *always* require layout saving to be unlocked (WorldUpgradeMetaUpgradeSaveLayout), in addition to any custom checks added here
GameStateRequirements = nil,
-- Insert after a specific cosmetic in the Training Grounds shop, or nil to append to end
InsertAfterCosmetic = nil,
-- Defaults to "How about a new look for the old Arcana..." when nil
PreRevealVoiceLines = nil,
})
Registering Card Backs
After registering a pack, register individual card backs for it. Card backs will be ordered by registration order within their pack.
CosmeticsAPI.RegisterCardBack({
-- REQUIRED FIELDS
Id = _PLUGIN.guid .. "." .. "MyCardBack_01",
-- Must match a previously registered pack ID
PackId = _PLUGIN.guid .. "." .. "MyCardBackPack",
-- Idle card art for the selection overlay (248×318 px). See vanilla: GUI\Screens\MetaUpgrade\DeckArt\Deck10
DeckArtPath = "AuthorName-ModName\\DeckArt\\MyDeck10",
-- Card back for the in-combat flip animation (453×680 px). See vanilla: GUI\Screens\CardBack\CardBack10
CardBackPath = "AuthorName-ModName\\CardBack\\MyCardBack10",
-- OPTIONAL FIELDS
-- Highlighted variant shown on hover (330×308 px). See vanilla: GUI\Screens\MetaUpgrade\DeckArt\DeckMouseover10
-- If nil, uses DeckArtPath (no hover effect)
DeckArtMouseoverPath = "AuthorName-ModName\\DeckArt\\MyDeckMouseover10",
DeckArtScale = nil,
})
Card backs from the same pack will appear grouped together in the selection screen. The API automatically handles pagination when the total number of unlocked card backs exceeds 40 (one page).
Sample card back textures
Textures should match vanilla dimensions exactly - the engine derives the display scale from the source texture size, and mismatched dimensions will cause card backs to appear at the wrong size.
| Texture | Vanilla Dimensions | Used In | Resizable via API? |
|---|---|---|---|
| DeckArt (per card) | 248 × 318 px | Card back picker overlay (idle) | Yes - DeckArtScale |
| DeckArtMouseover (per card) | 330 × 308 px | Card back picker overlay (hover) | Yes - DeckArtScale |
| CardBack (per card) | 453 × 680 px | In-combat Arcana card flip animation | No - the game applies a hardcoded scale during the flip animation, so this texture must match vanilla dimensions |
| IconPath (per pack) | 110 × 110 px | Training Grounds cosmetics shop | Yes - IconScale |
DeckArt (per card)
GUI\Screens\MetaUpgrade\DeckArt\Deck10

DeckArtMouseover (per card)
GUI\Screens\MetaUpgrade\DeckArt\DeckMouseover10

IconPath (per pack)
GUI\Screens\CosmeticIcons\cosmetic_deckMisc

CardBack (per card)
GUI\Screens\CardBack\CardBack10

Registering Chthonic Chids
You can register a new Chthonic Chid by calling CosmeticsAPI.RegisterChthonicChid(chidData), where chidData is a ChthonicChidData table.
CosmeticsAPI.RegisterChthonicChid({
-- You must prefix Chthonic Chid IDs with your mod GUID so the API can check if you've registered your new Chids beforehand
Id = _PLUGIN.guid .. "." .. "MyChid",
Name = {
en = "Chthonic Chid, Custom",
},
Description = {
en = "{$Keywords.CosmeticAdd}: Oddly proportioned collectable figure fashioned after no-one in particular.",
},
FlavorText = {
en = "“These usually have some quote as FlavorText.”",
},
Cost = {
CosmeticsPoints = 50,
},
CosmeticAnimationPath = "AuthorName-ModName\\FolderPath\\MyChid",
IconPath = "AuthorName-ModName\\FolderPath\\MyChid_Icon",
})
The API controls Chid placement on the shelf and uses a default animation scale of 0.247 * 391 / 94.
Draw your Chid on the provided template, keeping the location of the baseplate where it is.
Before your mod can register a new Chthonic Chid, you need to open a PR to this mod and add your exact mod GUID and Chid count to mod.ChthonicChidReservations in src\Scripts\Utils.lua.
Due to the limited number of slots available for Chthonic Chids on the shelf, the API requires all mods adding Chthonic Chids to register themselves explicitly to ensure there are no conflicts when users install multiple such mods. At the moment, 12 new slots are available (through two new levels added to the shelf).
Registering Familiar Costumes
To add a new skin/costume for a familiar, use RegisterFamiliarCostume.
You must provide at least one of GrannyModel or GrannyTexture, or both.
In most cases, you will provide GrannyTexture to apply a custom skin to the familiar's default model, or pass both to apply a custom skin to a non-default model.
You must register the package containing your custom skins with RegisterAlwaysLoadedPackages.
Skin icons for the shop should be in a separate package registered with RegisterCrossroadsPackages.
CosmeticsAPI.RegisterCrossroadsPackages({ "AuthorName-ModName-FamiliarIcons" })
CosmeticsAPI.RegisterAlwaysLoadedPackages({ "AuthorName-ModName-FamiliarSkins" })
CosmeticsAPI.RegisterFamiliarCostume({
-- REQUIRED FIELDS
Id = _PLUGIN.guid .. "." .. "FamiliarCostume_FrogDisco",
-- Possible values are `FrogFamiliar`, `RavenFamiliar`, `CatFamiliar`, `HoundFamiliar`, `PolecatFamiliar`
FamiliarName = "FrogFamiliar",
Name = { en = "Disco" },
Description = { en = "It's time to pump up the jam." },
IconPath = "AuthorName-ModName-FamiliarIcons\\Icons\\FamiliarCostume_FrogDisco_Icon",
-- OPTIONAL FIELDS
IconScale = 1,
-- Set a model name only to override the familiar's default costume model
GrannyModel = nil,
-- Override the model's texture
GrannyTexture = "AuthorName-ModName-FamiliarSkins\\FamiliarCostume_FrogDisco_Color",
-- Outline arguments. Can contain R, G, B, Alpha, Opacity, Thickness and Threshold values. In vanilla, used e.g. for Nightmarish skins
Outline = nil,
Cost = { CosmeticsPoints = 50 },
GameStateRequirements = {},
AlwaysRevealImmediately = false,
-- Check the vanilla familiar costumes for the available tables for this and SwitchCostumeVoiceLines, there are variants per familiar and costume "vibe"
PreRevealVoiceLines = {
{ GlobalVoiceLines = "FamiliarFrogCostumeUnlocked" },
},
SwitchCostumeVoiceLines = {
{ GlobalVoiceLines = "FamiliarFrogSwitchCostumeVoiceLines" },
},
})
You can use SelectFamiliarCostume(familiarName, id) to select an already-owned familiar costume through your mod's code, and the game will apply the selection the next time it sets up the familiar's costume (which happens whenever the familiar is spawned on a map, or during purchase/costume swap events).
You do not need to call this to apply the costume after it is purchased, this will happen automatically.
Only use this function if you want to change the equipped costume outside of the normal purchase or costume swap flow.
Most of the implementation for custom familiar skins was first made by @zerp for the Familiar Costume Randomizer mod.
Packing Familiar Skin Textures
Use MelSkin's build_pkg.py and pkg_builder.py, based on the CG3H toolkit to package your familiar skins (this avoids some texture flickering that you can get if packing normally through deppth2).
Create the two script files in your mod repo's root directory, then create the data output directry and place your texture PNGs in a textures folder, for example textures\FamiliarCostume_FrogDisco_Color.png:
.
|-- build_pkg.py
|-- pkg_builder.py
|-- data/
|-- textures/
| `-- FamiliarCostume_FrogDisco_Color.png
Then install the required dependencies and run the script through:
python -m pip install pillow lz4 etcpak
python .\build_pkg.py -s .\textures -t .\data\AuthorName-ModName-FamiliarSkins
Keep the package with your icons separate from the familiar skin textures.
The familiar skin texture package does not need a .pkg_manifest file.
Important Note & Contributing
If you want to add a variant cosmetic for a base game "Extra Decor" item, the Cosmetics API must know the CosmeticAnimationPath (SetAnimationValue) of the base game cosmetic, as these are not part of the cosmetics definition for all "Extra Decor" items.
The Cosmetics API has a list of known animation names for some cosmetics (naturally growing on-demand), so if you want to add a new variant, you must first open a PR against the Cosmetics API to add the unknown animation name to the list.
If the Cosmetics API does not know the base animation name, it will throw an error when you try to register your new cosmetic.
You can find the list under ./src/Scripts/Utils.lua, mod.KnownExtraDecorBaseAnimations.
You can most often get the SetAnimationValue from the Game/Obstacles/Crossroads.sjson file.
Most obstacles in this file are named "Crossroads<Cosmetic name without "Cosmetic_" prefix>01".
The SetAnimationValue we need is the Thing.Graphic of the obstacle, NOT the obstacle name itself.
Some cosmetics may require additional overrides to work correctly with modded cosmetics, you can add them there as well.
This is e.g. the case if the vanilla cosmetic defines ActivateIds, which would all get set to the new SetAnimationValue if no separate SetAnimationIds table is provided.