Merge pull request #336 from Buurazu/master
Overhaul eid_modifiers, fix line break bug
This commit is contained in:
9 files changed
+131
-209
No files matched your search
@@ -16,7 +16,7 @@ EID.descriptions[languageCode].custom = {} -- table for custom entity descriptio
|
||||
EID.descriptions[languageCode].languageName = "English"
|
||||
|
||||
-- Fonts to be used with this language pack
|
||||
EID.descriptions[languageCode].fonts = {{name="default", lineHeight=11, textboxWidth = 115}, {name="inverted", lineHeight=11, textboxWidth = 115}, {name="borderless", lineHeight=11, textboxWidth = 115}}
|
||||
EID.descriptions[languageCode].fonts = {{name="default"}, {name="inverted"}, {name="borderless"}}
|
||||
|
||||
---------- Collectibles ----------
|
||||
EID.descriptions[languageCode].collectibles={
|
||||
|
||||
@@ -27,6 +27,7 @@ local repCollectibles={
|
||||
[29] = {"29", "Mom's Underwear", "↑ +1.5 Range up#Spawns 3-6 Blue Flies"}, -- Mom's Underwear
|
||||
[30] = {"30", "Mom's Heels", "↑ +1.5 Range up#Touched enemies take 12 damage"}, -- Mom's Heels
|
||||
[31] = {"31", "Mom's Lipstick", "↑ +2.25 Range up#Spawns 1 random heart"}, -- Mom's Lipstick
|
||||
[37] = {"37", "Mr. Boom", "Drops a large bomb below the player which deals 185 damage"}, -- Mr. Boom
|
||||
[40] = {"40", "Kamikaze!", "Causes a big explosion at the player's location#Deals 185 damage"}, -- Kamikaze!
|
||||
[42] = {"42", "Bob's Rotten Head", "Throwable poison bomb#Deals 185 + your damage#Creates poison cloud"}, -- Bob's Rotten Head
|
||||
[44] = {"44", "Teleport", "Teleports Isaac into a random room except I AM ERROR rooms#Influence direction a bit by moving in desired direction"}, -- Teleport
|
||||
@@ -326,7 +327,7 @@ local repCollectibles={
|
||||
[673] = {"673", "Redemption", "Grants 1 Soul Heart and +1 Damage when entering a {{DevilRoom}}Devil Room and not taking any item/pickup"}, -- Redemption
|
||||
[674] = {"674", "Spirit Shackles", "On death, Isaac's ghost is chained to his dead body and he can continue to fight with half a heart#Return to life after 10 seconds#Must be recharged by picking up a Soul Heart"}, -- Spirit Shackles
|
||||
[675] = {"675", "Cracked Orb", "When you take damage:#Unlocks locked doors in the current room#Reveals a random room#Destroys all tinted and crawlspace rocks#Can open story doors#Can reveal the {{UltraSecretRoom}}Ultra Secret Room"}, -- Cracked Orb
|
||||
[676] = {"676", "Empty Heart", "When having an empty heart container at the start of a new floor, grants another one#Bone Hearts don't count"}, -- Empty Heart
|
||||
[676] = {"676", "Empty Heart", "When down to 1 Red Heart or less at the start of a new floor, grants an empty Heart Container#No effect for characters that can't have Red Hearts"}, -- Empty Heart
|
||||
[677] = {"677", "Astral Projection", "When getting hit, stops time for 3 seconds#Isaac becomes a ghost and leaves his body#In ghost form gain flight, spectral tears and also negate next hit taken"}, -- Astral Projection
|
||||
[678] = {"678", "C Section", "Gain a short delay charge attack that fires homing, spectral fetus tears"}, -- C Section
|
||||
[679] = {"679", "Lil Abaddon", "Familiar which shoots a mini {{Collectible399}}Maw of the Void attack"}, -- Lil Abaddon
|
||||
|
||||
+11
-6
@@ -323,8 +323,13 @@ function EID:getDescriptionObj(Type, Variant, SubType, entity)
|
||||
|
||||
description.ModName = tableEntry and tableEntry[4]
|
||||
|
||||
for _, modifier in pairs(EID.DescModifiers) do
|
||||
if modifier.condition(description) then
|
||||
for _,modifier in pairs(EID.DescModifiers) do
|
||||
local result = modifier.condition(description)
|
||||
if type(result) == "table" then
|
||||
for _,callback in ipairs(result) do
|
||||
description = callback(description)
|
||||
end
|
||||
elseif result then
|
||||
description = modifier.callback(description)
|
||||
end
|
||||
end
|
||||
@@ -794,8 +799,8 @@ function EID:fitTextToWidth(str, textboxWidth, breakUtf8Chars)
|
||||
end
|
||||
local strFiltered, spriteTable = EID:filterIconMarkup(table.concat(filteredWord), 0, 0)
|
||||
local wordLength = EID:getStrWidth(strFiltered)
|
||||
|
||||
if curLength + wordLength <= textboxWidth or curLength < 12 then
|
||||
|
||||
if curLength + wordLength <= textboxWidth or curLength < 17 then
|
||||
table.insert(text, word)
|
||||
curLength = curLength + wordLength
|
||||
else
|
||||
@@ -1108,8 +1113,8 @@ function EID:fixDefinedFont()
|
||||
end
|
||||
end
|
||||
EID.Config["FontType"] = EID.descriptions[curLang].fonts[1].name
|
||||
EID.lineHeight = EID.descriptions[curLang].fonts[1].lineHeight
|
||||
EID.Config["TextboxWidth"] = EID.descriptions[curLang].fonts[1].textboxWidth
|
||||
EID.Config["LineHeight"] = EID.descriptions[curLang].fonts[1].lineHeight or EID.DefaultConfig["LineHeight"]
|
||||
EID.Config["TextboxWidth"] = EID.descriptions[curLang].fonts[1].textboxWidth or EID.DefaultConfig["TextboxWidth"]
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
@@ -1103,7 +1103,7 @@ function EID:handleBagOfCraftingRendering()
|
||||
if not v then break end
|
||||
if (curOffset > bagOfCraftingOffset) then
|
||||
if not EID.Config["BagOfCraftingDisplayNames"] then
|
||||
customDescObj.Description = customDescObj.Description.."# {{Collectible"..v[2].."}} "
|
||||
customDescObj.Description = customDescObj.Description.."#{{Collectible"..v[2].."}} "
|
||||
--tack on the secondary recipe image to achievement-locked recipes
|
||||
if v[3] then customDescObj.Description = customDescObj.Description.."({{Collectible" .. v[3] .. "}})" end
|
||||
--color the equals sign with the item quality, so the order of the list can make sense
|
||||
@@ -1112,13 +1112,13 @@ function EID:handleBagOfCraftingRendering()
|
||||
else
|
||||
if prevItem ~= v[2] then
|
||||
--substring the first 18 characters of the item name so it fits on one line; is there a way to get around desc line length limits?
|
||||
customDescObj.Description = customDescObj.Description.."# {{Collectible"..v[2].."}} ".. qualities[CraftingItemQualities[v[2]]] ..
|
||||
customDescObj.Description = customDescObj.Description.."#{{Collectible"..v[2].."}} ".. qualities[CraftingItemQualities[v[2]]] ..
|
||||
string.sub(EID:getObjectName(5, 100, v[2]),1,18).."#"
|
||||
else
|
||||
customDescObj.Description = customDescObj.Description.."#"
|
||||
end
|
||||
--replace recipe bulletpoint with the secondary recipe on achievement-locked recipes
|
||||
if v[3] then customDescObj.Description = customDescObj.Description.." {{Collectible" .. v[3] .. "}} " end
|
||||
if v[3] then customDescObj.Description = customDescObj.Description.."{{Collectible" .. v[3] .. "}} " end
|
||||
end
|
||||
|
||||
customDescObj.Description = customDescObj.Description..tableToCraftingIconsFunc(self, v[1], true)
|
||||
|
||||
+3
-3
@@ -25,8 +25,8 @@ EID.UserConfig = {
|
||||
-- Default = "default"
|
||||
["FontType"] = "default",
|
||||
-- Change the width of the info boxes (in characters).
|
||||
-- Default = 115
|
||||
["TextboxWidth"] = 115,
|
||||
-- Default = 130
|
||||
["TextboxWidth"] = 130,
|
||||
-- Change the size of the info boxes. Range: [0,...,1]
|
||||
-- Default = 1
|
||||
["Scale"] = 1,
|
||||
@@ -345,7 +345,7 @@ EID.DefaultConfig = {
|
||||
["Language"] = "en_us",
|
||||
["TranslateItemName"] = 2,
|
||||
["FontType"] = "default",
|
||||
["TextboxWidth"] = 115,
|
||||
["TextboxWidth"] = 130,
|
||||
["Scale"] = 1,
|
||||
["ScaleKey"] = Keyboard.KEY_F5,
|
||||
["Transparency"] = 0.75,
|
||||
|
||||
+87
-170
@@ -1,11 +1,7 @@
|
||||
if REPENTANCE then
|
||||
local game = Game()
|
||||
local game = Game()
|
||||
|
||||
-- Handle Birthright
|
||||
local function BirthrightCondition(descObj)
|
||||
return descObj.ObjType == 5 and descObj.ObjVariant == PickupVariant.PICKUP_COLLECTIBLE and descObj.ObjSubType == 619
|
||||
end
|
||||
|
||||
local function BirthrightCallback(descObj)
|
||||
descObj.Description = ""
|
||||
local describedPlayerTypes = {}
|
||||
@@ -23,22 +19,9 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Birthright", BirthrightCondition, BirthrightCallback)
|
||||
|
||||
|
||||
|
||||
-- Handle Bingeeater description addition
|
||||
local function BingeeaterCondition(descObj)
|
||||
if descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_BINGE_EATER) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function BingeeaterCallback(descObj)
|
||||
local function BingeEaterCallback(descObj)
|
||||
local bingeBuff = EID:getDescriptionEntry("bingeEaterBuffs", descObj.ObjSubType)
|
||||
if bingeBuff ~= nil then
|
||||
local iconStr = "#{{Collectible664}} "
|
||||
@@ -46,27 +29,9 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Bingeeater", BingeeaterCondition, BingeeaterCallback)
|
||||
|
||||
|
||||
|
||||
-- Handle Book of Belial description for Judas' Birthright addition
|
||||
local function BookofBelialCondition(descObj)
|
||||
if descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
||||
return false
|
||||
end
|
||||
for i = 0,game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
local playerType = player:GetPlayerType()
|
||||
|
||||
if (playerType == PlayerType.PLAYER_JUDAS or playerType == PlayerType.PLAYER_BLACKJUDAS) and player:HasCollectible(CollectibleType.COLLECTIBLE_BIRTHRIGHT) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function BookofBelialCallback(descObj)
|
||||
local function BookOfBelialCallback(descObj)
|
||||
local belialBuff = EID:getDescriptionEntry("bookOfBelialBuffs", descObj.ObjSubType)
|
||||
if belialBuff ~= nil then
|
||||
local iconStr = "#{{Collectible34}} "
|
||||
@@ -74,21 +39,8 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("BookofBelial", BookofBelialCondition, BookofBelialCallback)
|
||||
|
||||
|
||||
|
||||
-- Handle Book of Virtues description addition
|
||||
local function BookOfVirtuesCondition(descObj)
|
||||
if descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_BOOK_OF_VIRTUES) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Handle Book of Virtues description addition
|
||||
local function BookOfVirtuesCallback(descObj)
|
||||
local wispType = EID:getDescriptionEntry("bookOfVirtuesWisps", descObj.ObjSubType)
|
||||
if wispType ~= nil then
|
||||
@@ -97,21 +49,8 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Book of Virtues", BookOfVirtuesCondition, BookOfVirtuesCallback)
|
||||
|
||||
|
||||
|
||||
-- Handle Spindown Dice description addition
|
||||
local function SpindownDiceCondition(descObj)
|
||||
if descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_SPINDOWN_DICE) or (EID.absorbedSpindown and EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_VOID)) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function SpindownDiceCallback(descObj)
|
||||
EID:appendToDescription(descObj, "#{{Collectible723}} :")
|
||||
local refID = descObj.ObjSubType
|
||||
@@ -140,21 +79,8 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Spindown Dice", SpindownDiceCondition, SpindownDiceCallback)
|
||||
|
||||
|
||||
|
||||
-- Handle Tarot Cloth description addition
|
||||
local function TarotClothCondition(descObj)
|
||||
if descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_TAROTCARD then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TAROT_CLOTH) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function TarotClothCallback(descObj)
|
||||
local clothBuff = EID:getDescriptionEntry("tarotClothBuffs", descObj.ObjSubType)
|
||||
if clothBuff ~= nil then
|
||||
@@ -163,29 +89,12 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Tarot Cloth", TarotClothCondition, TarotClothCallback)
|
||||
|
||||
|
||||
local hasBox = false
|
||||
local isGolden = false
|
||||
|
||||
-- Handle Golden Trinket / Mom's Box description addition
|
||||
local function GoldenTrinketCondition(descObj)
|
||||
if descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_TRINKET then
|
||||
return false
|
||||
end
|
||||
--check if our effect is doubled or tripled here
|
||||
hasBox = false
|
||||
isGolden = false
|
||||
if descObj.ObjSubType > TrinketType.TRINKET_GOLDEN_FLAG then
|
||||
isGolden = true
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_MOMS_BOX) then
|
||||
hasBox = true
|
||||
end
|
||||
return isGolden or hasBox
|
||||
end
|
||||
|
||||
-- Handle Golden Trinket / Mom's Box description addition
|
||||
local function GoldenTrinketCallback(descObj)
|
||||
local trinketID = descObj.ObjSubType % TrinketType.TRINKET_GOLDEN_FLAG
|
||||
local data = EID.GoldenTrinketData[trinketID]
|
||||
@@ -259,21 +168,9 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Golden Trinket", GoldenTrinketCondition, GoldenTrinketCallback)
|
||||
|
||||
|
||||
-- Handle Blank Card description addition
|
||||
local blankCardHidden = {[32]=true,[33]=true,[34]=true,[35]=true,[36]=true,[37]=true,[38]=true,[39]=true,[40]=true,[41]=true,[49]=true,[50]=true,[55]=true,[78]=true}
|
||||
local function BlankCardCondition(descObj)
|
||||
if not REPENTANCE or descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_TAROTCARD or blankCardHidden[descObj.ObjSubType] or descObj.ObjSubType > 80 then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_BLANK_CARD) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function BlankCardCallback(descObj)
|
||||
local text = EID:getDescriptionEntry("BlankCardCharge")
|
||||
local charge = EID.cardMetadata[descObj.ObjSubType]
|
||||
@@ -288,22 +185,9 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Blank Card", BlankCardCondition, BlankCardCallback)
|
||||
|
||||
|
||||
|
||||
-- Handle Clear Rune description addition
|
||||
local runeIDs = {[32]=true,[33]=true,[34]=true,[35]=true,[36]=true,[37]=true,[38]=true,[39]=true,[40]=true,[41]=true,[55]=true,[81]=true,[82]=true,[83]=true,[84]=true,[85]=true,[86]=true,[87]=true,[88]=true,[89]=true,[90]=true,[91]=true,[92]=true,[93]=true,[94]=true,[95]=true,[96]=true,[97]=true,}
|
||||
local function ClearRuneCondition(descObj)
|
||||
if not REPENTANCE or descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_TAROTCARD or not runeIDs[descObj.ObjSubType] then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_CLEAR_RUNE) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function ClearRuneCallback(descObj)
|
||||
local text = EID:getDescriptionEntry("ClearRuneCharge")
|
||||
local charge = EID.cardMetadata[descObj.ObjSubType]
|
||||
@@ -313,21 +197,8 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Clear Rune", ClearRuneCondition, ClearRuneCallback)
|
||||
|
||||
|
||||
|
||||
-- Handle Placebo description addition
|
||||
local function PlaceboCondition(descObj)
|
||||
if not REPENTANCE or descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_PILL then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_PLACEBO) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function PlaceboCallback(descObj)
|
||||
local text = EID:getDescriptionEntry("PlaceboCharge")
|
||||
local adjustedID = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
|
||||
@@ -338,19 +209,8 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Placebo", PlaceboCondition, PlaceboCallback)
|
||||
|
||||
-- Handle False PHD description addition
|
||||
local function FalsePHDCondition(descObj)
|
||||
if not REPENTANCE or descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_PILL then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_FALSE_PHD) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function FalsePHDCallback(descObj)
|
||||
local adjustedID = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
|
||||
local horse = descObj.ObjSubType > 2048
|
||||
@@ -370,20 +230,8 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("False PHD", FalsePHDCondition, FalsePHDCallback)
|
||||
|
||||
|
||||
-- Handle Abyss description addition
|
||||
local function AbyssCondition(descObj)
|
||||
if not REPENTANCE or descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_ABYSS) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function AbyssCallback(descObj)
|
||||
local text = EID:getDescriptionEntry("abyssSynergies", descObj.ObjSubType)
|
||||
if text ~= nil then
|
||||
@@ -392,20 +240,8 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Abyss", AbyssCondition, AbyssCallback)
|
||||
|
||||
|
||||
-- Handle Flip description addition
|
||||
local function FlipCondition(descObj)
|
||||
if not REPENTANCE or not EID:getEntityData(descObj.Entity, "EID_FlipItemID") then
|
||||
return false
|
||||
end
|
||||
if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_FLIP) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function FlipCallback(descObj)
|
||||
local flipItemID = EID:getEntityData(descObj.Entity, "EID_FlipItemID")
|
||||
if flipItemID <= 0 then return descObj end
|
||||
@@ -423,6 +259,87 @@ local game = Game()
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
EID:addDescriptionModifier("Flip", FlipCondition, FlipCallback)
|
||||
|
||||
|
||||
--------------------------------
|
||||
-- Although individual conditions/callbacks work well for mods to be able to add through the API,
|
||||
-- As we kept adding callbacks for vanilla items, a lot of code got repeated over and over
|
||||
-- This one-condition setup fixes that and can only help performance
|
||||
-- It also allows us to pick the order that modifiers are appended to descriptions (stats/effects first, then reroll/flip/recharge info)
|
||||
|
||||
local collectiblesToCheck = { CollectibleType.COLLECTIBLE_BINGE_EATER, CollectibleType.COLLECTIBLE_BOOK_OF_VIRTUES,
|
||||
CollectibleType.COLLECTIBLE_SPINDOWN_DICE, CollectibleType.COLLECTIBLE_VOID,
|
||||
CollectibleType.COLLECTIBLE_TAROT_CLOTH, CollectibleType.COLLECTIBLE_MOMS_BOX,
|
||||
CollectibleType.COLLECTIBLE_BLANK_CARD, CollectibleType.COLLECTIBLE_CLEAR_RUNE, CollectibleType.COLLECTIBLE_PLACEBO,
|
||||
CollectibleType.COLLECTIBLE_FALSE_PHD, CollectibleType.COLLECTIBLE_ABYSS, CollectibleType.COLLECTIBLE_FLIP,
|
||||
}
|
||||
local collectiblesOwned = {}
|
||||
|
||||
local function EIDConditions(descObj)
|
||||
-- currently, only pickup descriptions have modifiers
|
||||
if descObj.ObjType ~= 5 then return false end
|
||||
|
||||
-- recheck the players' owned collectibles periodically, not every frame
|
||||
if game:GetFrameCount() % 10 == 0 then
|
||||
local numPlayers = game:GetNumPlayers()
|
||||
local players = {}; for i = 0, numPlayers - 1 do players[i] = Isaac.GetPlayer(i) end
|
||||
for _,v in ipairs(collectiblesToCheck) do
|
||||
collectiblesOwned[v] = false
|
||||
for i = 0, numPlayers - 1 do
|
||||
if players[i]:HasCollectible(v) then
|
||||
collectiblesOwned[v] = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Birthright Book of Belial
|
||||
collectiblesOwned[59] = false
|
||||
for i = 0, numPlayers - 1 do
|
||||
local playerType = players[i]:GetPlayerType()
|
||||
if (playerType == PlayerType.PLAYER_JUDAS or playerType == PlayerType.PLAYER_BLACKJUDAS) and players[i]:HasCollectible(CollectibleType.COLLECTIBLE_BIRTHRIGHT) then
|
||||
collectiblesOwned[59] = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local callbacks = {}
|
||||
|
||||
-- Collectible Pedestal Callbacks
|
||||
if descObj.ObjVariant == PickupVariant.PICKUP_COLLECTIBLE then
|
||||
-- Using magic numbers here in case it's slightly faster, and because the callback names give context
|
||||
-- Check Birthright first because it overwrites the description instead of appending to it
|
||||
if descObj.ObjSubType == 619 then table.insert(callbacks, BirthrightCallback) end
|
||||
|
||||
if collectiblesOwned[664] then table.insert(callbacks, BingeEaterCallback) end
|
||||
if collectiblesOwned[59] then table.insert(callbacks, BookOfBelialCallback) end
|
||||
if collectiblesOwned[584] then table.insert(callbacks, BookOfVirtuesCallback) end
|
||||
if collectiblesOwned[706] then table.insert(callbacks, AbyssCallback) end
|
||||
|
||||
if collectiblesOwned[723] or (EID.absorbedSpindown and collectiblesOwned[477]) then table.insert(callbacks, SpindownDiceCallback) end
|
||||
if collectiblesOwned[711] and EID:getEntityData(descObj.Entity, "EID_FlipItemID") then table.insert(callbacks, FlipCallback) end
|
||||
-- Card / Rune Callbacks
|
||||
elseif descObj.ObjVariant == PickupVariant.PICKUP_TAROTCARD then
|
||||
if collectiblesOwned[451] then table.insert(callbacks, TarotClothCallback) end
|
||||
|
||||
if collectiblesOwned[286] and not blankCardHidden[descObj.ObjSubType] and descObj.ObjSubType <= 80 then table.insert(callbacks, BlankCardCallback) end
|
||||
if collectiblesOwned[263] and runeIDs[descObj.ObjSubType] then table.insert(callbacks, ClearRuneCallback) end
|
||||
-- Pill Callbacks
|
||||
elseif descObj.ObjVariant == PickupVariant.PICKUP_PILL then
|
||||
if collectiblesOwned[654] then table.insert(callbacks, FalsePHDCallback) end
|
||||
|
||||
if collectiblesOwned[348] then table.insert(callbacks, PlaceboCallback) end
|
||||
-- Trinket Callbacks
|
||||
elseif descObj.ObjVariant == PickupVariant.PICKUP_TRINKET then
|
||||
-- Golden Trinket / Mom's Box
|
||||
isGolden = (descObj.ObjSubType > TrinketType.TRINKET_GOLDEN_FLAG)
|
||||
hasBox = collectiblesOwned[439]
|
||||
if isGolden or hasBox then table.insert(callbacks, GoldenTrinketCallback) end
|
||||
end
|
||||
|
||||
return callbacks
|
||||
end
|
||||
EID:addDescriptionModifier("EID Repentance", EIDConditions, nil)
|
||||
|
||||
end
|
||||
@@ -56,6 +56,8 @@ local function parseEffectLine(raw)
|
||||
|
||||
-- words[1] = "[INFO]", words[2] = "-"
|
||||
local effectTrigger = words[3]
|
||||
-- the effects list is rarely interrupted by music loading log entries, just ignore it and have a slightly inaccurate desc
|
||||
if effectTrigger == "Queued" then return "" end
|
||||
if (string.find(effectTrigger, "entity_spawned")) then
|
||||
effectTrigger = "entity_spawned"
|
||||
triggerReplacements[1] = "{{ColorEIDObjName}}" .. entityToName(string.sub(words[3], 16, -2)) .. "{{CR}}"
|
||||
|
||||
@@ -441,6 +441,7 @@ function EID:printDescription(desc)
|
||||
local textScale = Vector(EID.Scale, EID.Scale)
|
||||
local renderPos = EID:getTextPosition()
|
||||
local offsetX = 0
|
||||
EID.lineHeight = EID.Config["LineHeight"]
|
||||
if EID.Config["ShowItemIcon"] then
|
||||
local iconType = nil
|
||||
local subType = desc.ObjSubType
|
||||
@@ -809,6 +810,7 @@ function EID:onGameUpdate()
|
||||
EID:setPlayer()
|
||||
|
||||
--Fix Overlapping Pedestals
|
||||
-- PERFORMANCENOTE move this to a post pickup init or something
|
||||
local curPositions = {}
|
||||
for _, entity in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do
|
||||
local pos = entity.Position
|
||||
@@ -843,8 +845,11 @@ function EID:onGameUpdate()
|
||||
end
|
||||
if EID.pathCheckerEntity == nil then
|
||||
EID.pathCheckerEntity = game:Spawn(17, 3169, EID.player.Position, nullVector, EID.player ,0 , 4354) -- Spawns the EID Helper entity with seed that doesnt spawn rewards
|
||||
-- Spawns an Ultra Greed Door and makes it invisible and intangible (not fully tested yet)
|
||||
--EID.pathCheckerEntity = game:Spawn(294, 0, EID.player.Position, nullVector, EID.player, 0, 0)
|
||||
EID.pathCheckerEntity:ClearEntityFlags(EntityFlag.FLAG_APPEAR)
|
||||
EID.pathCheckerEntity:AddEntityFlags (EntityFlag.FLAG_PERSISTENT | EntityFlag.FLAG_NO_STATUS_EFFECTS | EntityFlag.FLAG_NO_SPRITE_UPDATE | EntityFlag.FLAG_HIDE_HP_BAR | EntityFlag.FLAG_NO_DEATH_TRIGGER)
|
||||
EID.pathCheckerEntity:AddEntityFlags (EntityFlag.FLAG_PERSISTENT | EntityFlag.FLAG_NO_STATUS_EFFECTS | EntityFlag.FLAG_NO_SPRITE_UPDATE | EntityFlag.FLAG_HIDE_HP_BAR | EntityFlag.FLAG_NO_DEATH_TRIGGER | EntityFlag.FLAG_FRIENDLY)
|
||||
if REPENTANCE then EID.pathCheckerEntity:AddEntityFlags(EntityFlag.FLAG_NO_QUERY) end
|
||||
EID.pathCheckerEntity.EntityCollisionClass = EntityCollisionClass.ENTCOLL_NONE
|
||||
EID.pathCheckerEntity.Visible = false
|
||||
EID.hasValidWalkingpath = false
|
||||
@@ -852,7 +857,7 @@ function EID:onGameUpdate()
|
||||
EID.pathCheckerEntity = nil
|
||||
else
|
||||
EID.pathCheckerEntity.Position = EID.player.Position
|
||||
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos ( EID.lastDescriptionEntity.Position, false )
|
||||
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos(EID.lastDescriptionEntity.Position, false)
|
||||
EID.pathfindingTo = EID.lastDescriptionEntity
|
||||
end
|
||||
end
|
||||
@@ -864,7 +869,7 @@ EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate)
|
||||
function EID:updatePathfinding()
|
||||
if not EID.pathCheckerEntity or not EID.lastDescriptionEntity then return end
|
||||
EID.pathCheckerEntity.Position = EID.player.Position
|
||||
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos ( EID.lastDescriptionEntity.Position, false )
|
||||
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos(EID.lastDescriptionEntity.Position, false)
|
||||
EID.pathfindingTo = EID.lastDescriptionEntity
|
||||
end
|
||||
|
||||
@@ -918,8 +923,6 @@ local function onRender(t)
|
||||
EID.isDisplaying = false
|
||||
EID:setPlayer()
|
||||
|
||||
--Keyboard hide keys are 32+, controller hide keys have their own option now so don't allow controller inputs in it
|
||||
if EID.Config["HideKey"] < 32 then EID.Config["HideKey"] = -1 end
|
||||
if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then
|
||||
EID.isHidden = not EID.isHidden
|
||||
end
|
||||
@@ -1047,7 +1050,7 @@ local function onRender(t)
|
||||
return
|
||||
end
|
||||
|
||||
--Handle Glitched Items
|
||||
-- Handle Glitched Items
|
||||
if closest.Type == 5 and closest.Variant == 100 and closest.SubType > 4294960000 then
|
||||
local glitchedObj = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType)
|
||||
local glitchedDesc = EID:getXMLDescription(closest.Type, closest.Variant, closest.SubType)
|
||||
@@ -1062,16 +1065,12 @@ local function onRender(t)
|
||||
|
||||
EID:printDescription(glitchedObj)
|
||||
return
|
||||
end
|
||||
|
||||
if closest.Type == 1000 and closest.Variant == 76 then
|
||||
-- Handle Dice Room Floor
|
||||
elseif closest.Type == 1000 and closest.Variant == 76 then
|
||||
EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1, closest))
|
||||
return
|
||||
end
|
||||
|
||||
if closest.Type == 6 and closest.Variant == 16 then
|
||||
--Handle Crane Game
|
||||
|
||||
-- Handle Crane Game
|
||||
elseif closest.Type == 6 and closest.Variant == 16 then
|
||||
if EID.CraneItemType[tostring(closest.InitSeed)] then
|
||||
if EID:getEntityData(closest, "EID_DontHide") ~= true then
|
||||
if (EID:hasCurseBlind() and EID.Config["DisableOnCurse"]) or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then
|
||||
@@ -1197,10 +1196,10 @@ if EID.MCMLoaded or REPENTANCE then
|
||||
EID.absorbedSpindown = false
|
||||
|
||||
if isSave then
|
||||
EID.BagItems = savedEIDConfig["BagContent"]
|
||||
EID.bagOfCraftingRoomQueries = savedEIDConfig["BagFloorContent"]
|
||||
EID.CraneItemType = savedEIDConfig["CraneItemType"]
|
||||
EID.absorbedSpindown = savedEIDConfig["AbsorbedSpindownDice"]
|
||||
EID.BagItems = savedEIDConfig["BagContent"] or {}
|
||||
EID.bagOfCraftingRoomQueries = savedEIDConfig["BagFloorContent"] or {}
|
||||
EID.CraneItemType = savedEIDConfig["CraneItemType"] or {}
|
||||
EID.absorbedSpindown = savedEIDConfig["AbsorbedSpindownDice"] or false
|
||||
|
||||
-- turn list back into dict because json cant save dict indices.
|
||||
local flipItemTable = {}
|
||||
@@ -1241,7 +1240,6 @@ if EID.MCMLoaded or REPENTANCE then
|
||||
EID.isHidden = EID.Config["InitiallyHidden"]
|
||||
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
||||
EID.Scale = EID.Config["Scale"]
|
||||
EID.lineHeight = EID.Config["LineHeight"]
|
||||
|
||||
EID:fixDefinedFont()
|
||||
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
||||
@@ -1275,7 +1273,6 @@ if EID.MCMLoaded or REPENTANCE then
|
||||
end
|
||||
EID.Config["FlipItemPositions"] = flipItemTable or {}
|
||||
end
|
||||
EID.Config["LineHeight"] = EID.lineHeight
|
||||
EID.SaveData(EID, json.encode(EID.Config))
|
||||
EID:hidePermanentText()
|
||||
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil
|
||||
|
||||
+5
-5
@@ -320,17 +320,17 @@ if MCMLoaded then
|
||||
{
|
||||
Type = ModConfigMenu.OptionType.NUMBER,
|
||||
CurrentSetting = function()
|
||||
return EID.lineHeight
|
||||
return EID.Config["LineHeight"]
|
||||
end,
|
||||
Minimum = 1,
|
||||
Maximum = 100,
|
||||
Display = function()
|
||||
return "Line Height: " .. EID.lineHeight
|
||||
return "Line Height: " .. EID.Config["LineHeight"]
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
EID.lineHeight = currentNum
|
||||
EID.Config["LineHeight"] = currentNum
|
||||
end,
|
||||
Info = {"Default = 11","Lineheight will automatically change when changing a font/language"}
|
||||
Info = {"Default = 11","Line height will automatically change when changing a font/language"}
|
||||
}
|
||||
)
|
||||
-- Textbox Width
|
||||
@@ -351,7 +351,7 @@ if MCMLoaded then
|
||||
OnChange = function(currentNum)
|
||||
EID.Config["TextboxWidth"] = currentNum
|
||||
end,
|
||||
Info = {"Default = 115, varies per language","Width of the EID textbox, in pixels"}
|
||||
Info = {"Default = 130, varies per language","Width of the EID textbox, in pixels"}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user