The Binding of Isaac: Rebirth

The Binding of Isaac: Rebirth

AB+ | Detailed Respawn | Link for repentance version in the description
SupremeElf  [developer] 16 May, 2020 @ 12:24pm
API for modders
If you are a modder and you want your modded respawn item to support Detailed Respawn you are in the right place :D

Steam doesn't support code highlighing afaik so this might be a little annoying to read... You can try copying this to your code editor maybe?

First of all, all of the code releated to adding Detailed Respawn support should go into an if block:
if DetailedRespawn then -- releated code here end

Adding your item is as simple as calling:
if DetailedRespawn then DetailedRespawn.AddCustomRespawn(respawnObject, respawnPosition) end

respawnPosition can be one of three things:
1-
DetailedRespawn.RespawnPositions.First -- Your respawn item activated before any other respawn items (1up! is the first respawn item to activate, that means your respawn item activates even before 1up!)

2-
DetailedRespawn.RespawnPositions.Last -- Your respawn item activates after all other respawn items and trinkets (Missing Poster is the last respawn the activate meaning your respawn item activates after Missing Poster

3-
DetailedRespawn.RespawnPositions.After("respawn name") -- Your respawn item activates after "respawn name", "respawn name" being the name of the item your respawn item activates after (case sensitive). eg: DetailedRespawn.RespawnPositions.After("Judas' Shadow") means your item activates after Judas' Shadow

All possible respawn names in the order of them is:
  • 1up!
  • Lazarus' Rags
  • Dead Cat
  • Guppy's Collar
  • Ankh
  • Broken Ankh
  • Juads' Shadow
  • Missing Poster

As for respawnObject we have a couple of values:
Name = "NameOfRespawn", -- This is not optional, it is used to identify respawns, you can choose whatever name you want, probably makes sense to make it your item name.

ItemId = CollectibleId, -- If your respawn is from an item (eg dead cat, judas' shadow, 1up) set this to your item collectible id. If your respawn is not an item (eg missing poster, broken ankh, being the first lazarus) there is no need to set this but you will have to set other values that DetailedRespawn can't get by default (like the png path of your respawn and a condition to display it)

gfx = "png path for your file" -- If you set the ItemId to something there is no need to define this property, it will default to the item's sprite. If you didn't (like for the missing poster) you have to supply a png path.

PositionModifier = Vector(x, y) -- Optional! A position modifier for your icon, this is used for visual fixes, if the icon doesn't blend well with the other respawn items

Condition = function(player) return true end, -- A function that will be called to determine if you respawn item should be showen, function recieves the player so use that if you need it. If you did set ItemId this is not needed and will default to checking if the player has that item (this assumes your item is removed after it's used to respawn, like other respawn items.)

AdditionalText = "", -- Optional! Additional text to show under the item icon, this can be a string (like "22%" or "50%" for guppy's collar and broken ankh) and this can also be a function that takes the player as the first argument and returns a string

HasAltSprite = true -- Optinal! Set this to true if your respawn item has an alt sprite. Go further down to learn how to use alt sprites

Examples:
This are examples of respawn object for the default items that are in the game.
{ Name = "Lazarus' Rags", HasAltSprite = true, ItemId = CollectibleType.COLLECTIBLE_LAZARUS_RAGS }

{ Name = "Guppy's Collar", ItemId = CollectibleType.COLLECTIBLE_GUPPYS_COLLAR, AdditionalText = "50%", PositionModifier = Vector(1.5, 0) -- Move a little to the right since it's small },

{ Name = "Missing Poster", gfx = Isaac.GetItemConfig():GetTrinket(TrinketType.TRINKET_MISSING_POSTER).GfxFileName, HasAltSprite = true, PositionModifier = Vector(-2, 1), -- Move a down and a little to the left Condition = function(player) return player:HasTrinket(TrinketType.TRINKET_MISSING_POSTER) end }

Alt icons are an option the player can toggle in the settings to use alt icons.
Alt icons are using the character icon instead of the item icon.
For example use Dark Judas instead of Judas' Shadow.
If you have an item that respawn you as lilith (as an example), you might want to have an alt icon.
First set `HasAltSprite = true` in your respawnObject.
Then you need to put a 32x32 png icon named after the `name` property you defined in your `respawnObject` (this is your alt icon so it would be an icon of lilith for our example) in your mod's `resources/gfx/detailedrespawn/` folder. So you would have `yourmodname/resources/gfx/detailedrespawn/lilith.png` which is a 32x32.

To finish our lilith respawn item example lets look at how the code would look like!
if DetailedRespawn then DetailedRespawn.AddCustomRespawn({ Name = "Get Incubus A Friend", -- idk lol, in that case your png name for the alt sprite would be "Get Incubus A Friend.png" ItemId = LilithMod.COLLECTIBLE_GET_INCUBUS_A_FRIEND, HasAltSprite = true }, DetailedRespawn.RespawnPositions.After("Guppy's Collar")) end
And our item activates after Guppy's Collar and Before Ankh

Tell me if you decide to support your respawn items :D
If you need help just ask
Last edited by SupremeElf; 16 May, 2020 @ 12:34pm