From 0cf767bc51f2e19f55bc3c0a6498c80a6f53c2df Mon Sep 17 00:00:00 2001 From: Tiburones202 <103890376+Tiburones202@users.noreply.github.com> Date: Sun, 27 Oct 2024 21:23:58 +0100 Subject: [PATCH] Custom Poop API support. (#738) * Dynamic health HealingRed removal list HealingRed lines removal for custom health types support fixed orphan socks description not showing the soul heart markup Added and changed a lot of stuff from the Spanish EID * fixed a typo in the Spanish EID * Custom Poop API support. --- descriptions/rep/en_us.lua | 4 ++++ descriptions/rep/spa.lua | 6 ++++-- features/eid_api.lua | 11 +++++++++++ features/eid_holdmapdesc.lua | 26 ++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index 9aea2bae..ffdd2039 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -1292,6 +1292,10 @@ EID.descriptions[languageCode].poopSpells = { {"Fart", "Push nearby enemies and bullets back, and spawn a toxic cloud#{{Warning}} The cloud explodes if it touches fire!"}, {"Bomb", "Normal throwable bomb"}, {"Explosive Diarrhea", "Isaac quickly spawns 5 lit bombs"}, + + --Undetected poop, for Poop API + --[Poop name in code] = {Icon, Name, Description} + ["Unknown"] = {"{{PoopSpell1}}", "Unknown Poop", "The effects of the poop are Unknown"} } EID.descriptions[languageCode].itemPoolFor = "Pool for Item:" diff --git a/descriptions/rep/spa.lua b/descriptions/rep/spa.lua index 8cc7156a..20e49ec6 100644 --- a/descriptions/rep/spa.lua +++ b/descriptions/rep/spa.lua @@ -1087,18 +1087,20 @@ EID.descriptions[languageCode].GlitchedItemText = { ---------- Misc. Text ---------- -- Poop spells -EID.descriptions[languageCode].poopSpells = { +EID.descriptions[languageCode].poopSpells = { --¿Deberíamos cambiar "Popó" a "Caca"? (Y de paso poner nombres normales para los hechizos) {"Popó", "Popó normal, puede generar recolectables"}, {"Mazorqueada", "Genera moscas azules al estar intacta"}, {"¡ESTO ARDE!", "Inflige daño por contacto al estar intacta#{{Burning}} Genera fuego al ser destruida"}, {"Hice caca seca", "Can deal damage 3 times when thrown#Takes a lot of hits to destroy"}, {"Esto está podrido...", "{{Poison}} Genera nubes tóxicas#!!! ¡La nube explotará si entra en contacto con fuego!"}, - {"", "{{Slow}} Genera creep ralentizante#{{Confusion}} Inflige 10 de daño y confunde a los enemigos"}, + {"Popó Negra", "{{Slow}} Genera creep ralentizante#{{Confusion}} Inflige 10 de daño y confunde a los enemigos"}, {"¡Santa cagada!", "{{Collectible543}} Lanzas una popó blanca con un aura#Al estar dentro del aura, recibes:#↑ {{Damage}} Daño +20%#↑ {{Tears}} Lágrimas +150% #Lágrimas teledirigidas#Posibilidad de bloquear daño"}, {"Diarrea", "Dejas un camino de creep#Pararte sobre el creep otorga: #↑ {{Tears}} Más lágrimas#↑ {{Damage}} Más daño#Si el creep toca una popó con efecto especial, adquirirá sus propiedades"}, {"Un pedo", "Empuja enemigos y disparos#{{Poison}} Genera una bomba tóxico#!!! ¡La nube explotará si entra en contacto con fuego!"}, {"Bomba", "Normal throwable bomb"}, {"Diarrea explosiva", "Genera 5 bombas encendidas a tu paso"}, + + ["Unknown"] = {"{{PoopSpell1}}", "Popó Desconocida", "Los efectos de la popó son desconocidos"} } -- Poop spells end diff --git a/features/eid_api.lua b/features/eid_api.lua index e3e17d0d..3dfd2db4 100644 --- a/features/eid_api.lua +++ b/features/eid_api.lua @@ -279,6 +279,17 @@ function EID:addIcon(shortcut, animationName, animationFrame, width, height, lef EID.InlineIcons[shortcut] = {animationName, animationFrame, width, height, leftOffset, topOffset, spriteObject} end +-- Adds a custom poop spell to T???'s poop descriptions. This spell should be added with the "Custom Poop API" library to actually appear in-game. +-- Token is the name of the spell in the Custom Poop API code. Examples: "CORNY", "BURNING", "BOMB". +-- Name is the actual name you want to display. Examples: "Corny Poop", "Burning Poop", "Bomb". +-- Icon is the displayed poop icon. Should be a markup. +-- Description is the actual description showed to the player. Examples: "Spawns blue flies while intact", "Deals contact damage while intact#Leaves a fire behind when destroyed", "Normal throwable bomb". +-- Language is the language you want to add it to. Examples: "en_us", "spa", "ru". +-- EXAMPLE: EID:addCustomPoopSpell("MYPOOP", "I Made This Poop", "{{PoopSpell1}}", "Can be throwed to deal damage", "en_us") +function EID:addCustomPoopSpell(token, name, icon, description, language) + EID.descriptions[language]["poopSpells"][token] = {icon, name, description} +end + -- Adds a new color object with the shortcut defined in the "shortcut" variable (e.g. "{{shortcut}}" = your color) -- Shortcuts are case Sensitive! Shortcuts can be overriden with this function to allow for full control over everything -- Define a callback to let it be called when interpreting the color-markup. define a kColor otherwise for a simple color change diff --git a/features/eid_holdmapdesc.lua b/features/eid_holdmapdesc.lua index ee036462..91e600d7 100644 --- a/features/eid_holdmapdesc.lua +++ b/features/eid_holdmapdesc.lua @@ -600,6 +600,32 @@ function EID:ItemReminderHandlePoopSpells(player) local descsAvailableToRender = numAvailableDescriptionSlots for i = 0, 5 do -- max 6 poop spell slots local nextPoop = player:GetPoopSpell(i) + + --Custom Poop support + if CustomPoopAPI then + local poopSaveData = CustomPoopAPI.GetPersistentPlayerData(player) + nextPoop = PoopSpellType["SPELL_"..poopSaveData.Poops[i + 1]] --Yes, this works LOL + if nextPoop == nil then --Not a spell from the base game. Might add custom poop support eventually instead of skipping the creep. + nextPoop = PoopSpellType.SPELL_NONE --Prevent from rendering normally + local customPoop = EID:getDescriptionEntry("poopSpells")[poopSaveData.Poops[i + 1]] + + local ignoreExisting = false + if customPoop == nil then --If the poop still doesn't exist, use the unkown one instead + customPoop = EID:getDescriptionEntry("poopSpells")["Unknown"] or EID.descriptions["en_us"]["poopSpells"]["Unknown"] + ignoreExisting = true + end + + if ignoreExisting or not displayedPoopTypes[customPoop] then + EID:ItemReminderAddTempDescriptionEntry(customPoop[1], customPoop[2], customPoop[3]) + + displayedPoopTypes[customPoop] = true + + descsAvailableToRender = descsAvailableToRender - 1 + end + end + end + --End of custom poop support + if not displayedPoopTypes[nextPoop] then EID:ItemReminderAddTempDescriptionEntry("{{PoopSpell" .. nextPoop .. "}}", poopInfo[nextPoop][1], poopInfo[nextPoop][2])