Added more comments to some functions
This commit is contained in:
1 parent
cf2a02b051
commit
5f6bb5a981
4 files changed
+138
-45
No files matched your search
@@ -173,6 +173,7 @@ end
|
|||||||
---@param appendText? string | string[] @Text to be appended onto the description. Can be one string, or a table of two strings; one for doubling and one for tripling
|
---@param appendText? string | string[] @Text to be appended onto the description. Can be one string, or a table of two strings; one for doubling and one for tripling
|
||||||
---@param numbersToMultiply? number | number[] @The number inside the text that should be multiplied. can be one number, or a table of numbers
|
---@param numbersToMultiply? number | number[] @The number inside the text that should be multiplied. can be one number, or a table of numbers
|
||||||
---@param maxMultiplier? number @Is what tripling (Golden+Mom's Box) should multiply the numbers by, normally 3. If it's less than 2, it also applies to doubling
|
---@param maxMultiplier? number @Is what tripling (Golden+Mom's Box) should multiply the numbers by, normally 3. If it's less than 2, it also applies to doubling
|
||||||
|
---@param language? EID_LanguageCode @Default: "en"
|
||||||
-- Example: My modded trinket gives +0.5 range and when tripled, adds homing instead of tripling the range boost:
|
-- Example: My modded trinket gives +0.5 range and when tripled, adds homing instead of tripling the range boost:
|
||||||
--- ```lua
|
--- ```lua
|
||||||
--- EID:addGoldenTrinketMetadata(Isaac.GetTrinketIdByName("Cool Trinket"), {"", "Homing tears"}, 0.5, 2)
|
--- EID:addGoldenTrinketMetadata(Isaac.GetTrinketIdByName("Cool Trinket"), {"", "Homing tears"}, 0.5, 2)
|
||||||
@@ -194,14 +195,15 @@ function EID:addGoldenTrinketMetadata(id, appendText, numbersToMultiply, maxMult
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
---Adds information about appending text and adding to numbers in a modded trinket's Golden/Mom's Box description. All three variables are optional, set to ""/0 or nil to not include them
|
---Adds information about appending text and adding to numbers in a modded trinket's Golden/Mom's Box description. All three variables are optional, set to ""/0 or nil to not include them
|
||||||
|
---@param id TrinketType
|
||||||
---@param appendText? string | string[] @Text to be appended onto the description. Can be one string, or a table of two strings; one for doubling and one for tripling
|
---@param appendText? string | string[] @Text to be appended onto the description. Can be one string, or a table of two strings; one for doubling and one for tripling
|
||||||
---@param numbersToChange? number | number[] @The number inside the text that gets added towards. can be one number, or a table of numbers
|
---@param numbersToChange? number | number[] @The number inside the text that gets added towards. can be one number, or a table of numbers
|
||||||
---@param additiveValues? number @Table of values that should be added to the number, if its doubled, tripled, or quadrupled
|
---@param additiveValues? number @Table of values that should be added to the number, if its doubled, tripled, or quadrupled
|
||||||
|
---@param language? EID_LanguageCode @Default: "en"
|
||||||
-- Example: My modded trinket gives +5 range and when tripled, adds homing instead of tripling the range boost:
|
-- Example: My modded trinket gives +5 range and when tripled, adds homing instead of tripling the range boost:
|
||||||
--- ```lua
|
--- ```lua
|
||||||
--- EID:addGoldenTrinketMetadataAdditive(Isaac.GetTrinketIdByName("Cool Trinket"), {"", "Homing tears"}, 5, {1,2,3})
|
--- EID:addGoldenTrinketMetadataAdditive(Isaac.GetTrinketIdByName("Cool Trinket"), {"", "Homing tears"}, 5, {1,2,3})
|
||||||
--- ```
|
--- ```
|
||||||
|
|
||||||
function EID:addGoldenTrinketMetadataAdditive(id, appendText, numbersToChange, additiveValues, language)
|
function EID:addGoldenTrinketMetadataAdditive(id, appendText, numbersToChange, additiveValues, language)
|
||||||
language = language or "en"
|
language = language or "en"
|
||||||
|
|
||||||
@@ -223,7 +225,6 @@ end
|
|||||||
---Add a fully custom data table to the table of Golden Trinket effects.
|
---Add a fully custom data table to the table of Golden Trinket effects.
|
||||||
---Check GoldenTrinketCallback in [eid_modifiers.lua](eid_modifiers.lua) to see the specifics of how it works.
|
---Check GoldenTrinketCallback in [eid_modifiers.lua](eid_modifiers.lua) to see the specifics of how it works.
|
||||||
---You may also want to add text entries into `EID.descriptions[languageCode].goldenTrinketEffects`
|
---You may also want to add text entries into `EID.descriptions[languageCode].goldenTrinketEffects`
|
||||||
---<br><hr><br>
|
|
||||||
---@param id TrinketType
|
---@param id TrinketType
|
||||||
---@param dataTable EID_GoldenTrinketData
|
---@param dataTable EID_GoldenTrinketData
|
||||||
function EID:addGoldenTrinketTable(id, dataTable)
|
function EID:addGoldenTrinketTable(id, dataTable)
|
||||||
@@ -247,6 +248,8 @@ function EID:addCard(id, description, itemName, language)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- DEPRECATED! Does nothing! Don't use!
|
-- DEPRECATED! Does nothing! Don't use!
|
||||||
|
---@deprecated
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
function EID:addCardMetadata(id, mimicCharge, isRune)
|
function EID:addCardMetadata(id, mimicCharge, isRune)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -292,6 +295,7 @@ end
|
|||||||
---@param id PillEffect
|
---@param id PillEffect
|
||||||
---@param mimicCharge integer @DEPRECATED, does nothing
|
---@param mimicCharge integer @DEPRECATED, does nothing
|
||||||
---@param class? EID_PillClass @Default: "0". With False PHD, "3-" gives +0.6 Damage, "2-" and "1-" spawn a Black Heart
|
---@param class? EID_PillClass @Default: "0". With False PHD, "3-" gives +0.6 Damage, "2-" and "1-" spawn a Black Heart
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
function EID:addPillMetadata(id, mimicCharge, class)
|
function EID:addPillMetadata(id, mimicCharge, class)
|
||||||
EID.pillMetadata[id] = {
|
EID.pillMetadata[id] = {
|
||||||
class = class or "0",
|
class = class or "0",
|
||||||
@@ -1005,8 +1009,9 @@ function EID:getXMLDescription(Type, Variant, SubType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---Check if an entity is part of the describable entities
|
---Check if an entity is part of the describable entities
|
||||||
---@param entity Entity
|
---@param entity Entity | GridEntity
|
||||||
---@return boolean
|
---@return boolean
|
||||||
|
---@diagnostic disable: param-type-mismatch
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function EID:hasDescription(entity)
|
function EID:hasDescription(entity)
|
||||||
if not EID:EntitySanityCheck(entity) then return false end
|
if not EID:EntitySanityCheck(entity) then return false end
|
||||||
@@ -1681,7 +1686,7 @@ end
|
|||||||
|
|
||||||
---Checks if the given player has the given item ID (or is the given player ID)
|
---Checks if the given player has the given item ID (or is the given player ID)
|
||||||
---@param player EntityPlayer
|
---@param player EntityPlayer
|
||||||
---@param Type EntityType
|
---@param Type EntityType | string
|
||||||
---@param Var integer?
|
---@param Var integer?
|
||||||
---@param Sub integer?
|
---@param Sub integer?
|
||||||
---@return boolean
|
---@return boolean
|
||||||
|
|||||||
@@ -506,7 +506,8 @@ function EID:ItemReminderAddSpecialDescriptions(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Information about the player character's traits
|
-- Item Reminder function: Information about the player character's traits
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandleCharacterInfo(player)
|
function EID:ItemReminderHandleCharacterInfo(player)
|
||||||
local playerType = player:GetPlayerType()
|
local playerType = player:GetPlayerType()
|
||||||
local playerDesc = EID:getDescriptionEntry("CharacterInfo")[playerType]
|
local playerDesc = EID:getDescriptionEntry("CharacterInfo")[playerType]
|
||||||
@@ -515,7 +516,8 @@ function EID:ItemReminderHandleCharacterInfo(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Passive Item Descriptions
|
-- Item Reminder function: Passive Item Descriptions
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandleSelectedPassiveItem(player)
|
function EID:ItemReminderHandleSelectedPassiveItem(player)
|
||||||
local playerNum = EID:getPlayerID(player, true)
|
local playerNum = EID:getPlayerID(player, true)
|
||||||
if EID.RecentlyTouchedItems[playerNum] and #EID.RecentlyTouchedItems[playerNum] > 0 then
|
if EID.RecentlyTouchedItems[playerNum] and #EID.RecentlyTouchedItems[playerNum] > 0 then
|
||||||
@@ -523,7 +525,8 @@ function EID:ItemReminderHandleSelectedPassiveItem(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Active Item Descriptions
|
-- Item Reminder function: Active Item Descriptions
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandleActiveItems(player)
|
function EID:ItemReminderHandleActiveItems(player)
|
||||||
-- limit number of active item descriptions to 2, since Slot 3 and 4 are handled seperately
|
-- limit number of active item descriptions to 2, since Slot 3 and 4 are handled seperately
|
||||||
for i = 0, 1 do
|
for i = 0, 1 do
|
||||||
@@ -536,7 +539,8 @@ function EID:ItemReminderHandleActiveItems(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- pocket active
|
-- Item Reminder function: pocket actives
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandlePocketActive(player)
|
function EID:ItemReminderHandlePocketActive(player)
|
||||||
if not EID.isRepentance or not EID:ItemReminderCanAddMoreToView() then return end
|
if not EID.isRepentance or not EID:ItemReminderCanAddMoreToView() then return end
|
||||||
local pocketActive = player:GetActiveItem(2) or 0
|
local pocketActive = player:GetActiveItem(2) or 0
|
||||||
@@ -545,7 +549,8 @@ function EID:ItemReminderHandlePocketActive(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- dice bag
|
-- Item Reminder function: dice bag
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandleDiceBag(player)
|
function EID:ItemReminderHandleDiceBag(player)
|
||||||
if not EID.isRepentance or not EID:ItemReminderCanAddMoreToView() then return end
|
if not EID.isRepentance or not EID:ItemReminderCanAddMoreToView() then return end
|
||||||
|
|
||||||
@@ -555,7 +560,8 @@ function EID:ItemReminderHandleDiceBag(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Pocket Item Descriptions
|
-- Item Reminder function: Pocket Item Descriptions
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandlePocketItems(player)
|
function EID:ItemReminderHandlePocketItems(player)
|
||||||
for i = 0, 2 do
|
for i = 0, 2 do
|
||||||
if not EID:ItemReminderCanAddMoreToView() then return end
|
if not EID:ItemReminderCanAddMoreToView() then return end
|
||||||
@@ -576,7 +582,9 @@ function EID:ItemReminderHandlePocketItems(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Held trinkets are added at the end of the table; use this table in descending order
|
-- Item Reminder function: Held trinkets are added at the end of the table; use this table in descending order
|
||||||
|
---@param player EntityPlayer
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function EID:ItemReminderHeldPlusGulped(player)
|
function EID:ItemReminderHeldPlusGulped(player)
|
||||||
local playerNum = EID:getPlayerID(player, true)
|
local playerNum = EID:getPlayerID(player, true)
|
||||||
local newTable = {}
|
local newTable = {}
|
||||||
@@ -587,12 +595,14 @@ function EID:ItemReminderHeldPlusGulped(player)
|
|||||||
end
|
end
|
||||||
return newTable
|
return newTable
|
||||||
end
|
end
|
||||||
-- Trinket Descriptions
|
-- Item Reminder function: Trinket Descriptions
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandleTrinkets(player)
|
function EID:ItemReminderHandleTrinkets(player)
|
||||||
EID:ItemReminderHandleItemPrinting(player, EID:ItemReminderHeldPlusGulped(player), 350, true)
|
EID:ItemReminderHandleItemPrinting(player, EID:ItemReminderHeldPlusGulped(player), 350, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Tainted ??? Poop Descriptions
|
-- Item Reminder function: Tainted ??? Poop Descriptions
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandlePoopSpells(player)
|
function EID:ItemReminderHandlePoopSpells(player)
|
||||||
if EID.isRepentance and player:GetPlayerType() == 25 and EID:ItemReminderCanAddMoreToView() then
|
if EID.isRepentance and player:GetPlayerType() == 25 and EID:ItemReminderCanAddMoreToView() then
|
||||||
local poopInfo = EID:getDescriptionEntry("poopSpells")
|
local poopInfo = EID:getDescriptionEntry("poopSpells")
|
||||||
@@ -646,13 +656,14 @@ function EID:ItemReminderHandlePoopSpells(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Lemegeton wisp descriptions
|
-- Item Reminder function: Lemegeton wisp descriptions
|
||||||
|
---@param player EntityPlayer
|
||||||
function EID:ItemReminderHandleLemegetonWisps(player)
|
function EID:ItemReminderHandleLemegetonWisps(player)
|
||||||
local playerNum = EID:getPlayerID(player, true)
|
local playerNum = EID:getPlayerID(player, true)
|
||||||
EID:ItemReminderHandleItemPrinting(player, EID.WispsPerPlayer[playerNum], 100, false)
|
EID:ItemReminderHandleItemPrinting(player, EID.WispsPerPlayer[playerNum], 100, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Handle scroll inputs
|
-- Item Reminder function: Handle scroll inputs
|
||||||
function EID:ItemReminderHandleInputs()
|
function EID:ItemReminderHandleInputs()
|
||||||
if EID.Config["ItemReminderEnabled"] and EID.Config["ItemReminderDisplayMode"] ~= "Classic" and EID.holdTabCounter >= 30 and EID.TabDescThisFrame == false and EID.holdTabPlayer ~= nil then
|
if EID.Config["ItemReminderEnabled"] and EID.Config["ItemReminderDisplayMode"] ~= "Classic" and EID.holdTabCounter >= 30 and EID.TabDescThisFrame == false and EID.holdTabPlayer ~= nil then
|
||||||
if EID.Config["ItemReminderDisableInputs"] then EID.holdTabPlayer.ControlsCooldown = 2 end
|
if EID.Config["ItemReminderDisableInputs"] then EID.holdTabPlayer.ControlsCooldown = 2 end
|
||||||
@@ -695,10 +706,10 @@ function EID:ItemReminderHandleInputs()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- special list of all players, ignoring tainted forgotten ghost and coop babies
|
-- Item Reminder function: special list of all players, ignoring tainted forgotten ghost and coop babies
|
||||||
function EID:ItemReminderGetAllPlayers()
|
function EID:ItemReminderGetAllPlayers()
|
||||||
local filteredPlayerList = {}
|
local filteredPlayerList = {}
|
||||||
for i, player in ipairs(EID.coopAllPlayers) do
|
for _, player in ipairs(EID.coopAllPlayers) do
|
||||||
if not (EID.isRepentance and player:GetPlayerType() == PlayerType.PLAYER_THESOUL_B) and player:GetBabySkin() == -1 then
|
if not (EID.isRepentance and player:GetPlayerType() == PlayerType.PLAYER_THESOUL_B) and player:GetBabySkin() == -1 then
|
||||||
table.insert(filteredPlayerList, player)
|
table.insert(filteredPlayerList, player)
|
||||||
end
|
end
|
||||||
@@ -706,14 +717,20 @@ function EID:ItemReminderGetAllPlayers()
|
|||||||
return filteredPlayerList
|
return filteredPlayerList
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Item Reminder function: check if the currently selected category is scrollable
|
||||||
|
---@return boolean
|
||||||
function EID:IsScrollableCategorySelected()
|
function EID:IsScrollableCategorySelected()
|
||||||
return EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1].isScrollable
|
return EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1].isScrollable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Item Reminder function: check if the given category is currently selected
|
||||||
|
---@param categoryID integer
|
||||||
|
---@return boolean
|
||||||
function EID:IsCategorySelected(categoryID)
|
function EID:IsCategorySelected(categoryID)
|
||||||
return EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1].id == categoryID
|
return EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1].id == categoryID
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Item Reminder function: Resets data when initializing holding TAB
|
||||||
function EID:ItemReminderHandleInitHoldTab()
|
function EID:ItemReminderHandleInitHoldTab()
|
||||||
local oldDisplayPlayer = EID.ItemReminderSelectedPlayer
|
local oldDisplayPlayer = EID.ItemReminderSelectedPlayer
|
||||||
|
|
||||||
@@ -734,6 +751,8 @@ function EID:ItemReminderHandleInitHoldTab()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Returns the title of the currently selected Item Reminder category.
|
||||||
|
---@return string
|
||||||
function EID:ItemReminderGetTitle()
|
function EID:ItemReminderGetTitle()
|
||||||
local category = EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1]
|
local category = EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1]
|
||||||
|
|
||||||
@@ -836,19 +855,21 @@ function EID:ItemReminderHandleItemPrinting(player, entryTable, itemVariant, des
|
|||||||
|
|
||||||
if descending then
|
if descending then
|
||||||
local startIndex = (#entryTable - EID.ItemReminderSelectedItems[EID.ItemReminderSelectedCategory] - 1) % #entryTable
|
local startIndex = (#entryTable - EID.ItemReminderSelectedItems[EID.ItemReminderSelectedCategory] - 1) % #entryTable
|
||||||
for i = 1, descsToDisplay do
|
for _ = 1, descsToDisplay do
|
||||||
EID:ItemReminderAddDescription(player, 5, itemVariant, entryTable[startIndex+1] % GLITCH_ITEM_FLAG)
|
EID:ItemReminderAddDescription(player, 5, itemVariant, entryTable[startIndex+1] % GLITCH_ITEM_FLAG)
|
||||||
startIndex = (startIndex - 1) % #entryTable
|
startIndex = (startIndex - 1) % #entryTable
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local startIndex = EID.ItemReminderSelectedItems[EID.ItemReminderSelectedCategory] % #entryTable
|
local startIndex = EID.ItemReminderSelectedItems[EID.ItemReminderSelectedCategory] % #entryTable
|
||||||
for i = 1, descsToDisplay do
|
for _ = 1, descsToDisplay do
|
||||||
EID:ItemReminderAddDescription(player, 5, itemVariant, entryTable[startIndex+1] % GLITCH_ITEM_FLAG)
|
EID:ItemReminderAddDescription(player, 5, itemVariant, entryTable[startIndex+1] % GLITCH_ITEM_FLAG)
|
||||||
startIndex = (startIndex + 1) % #entryTable
|
startIndex = (startIndex + 1) % #entryTable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Generates the description for the Item Reminder, based on the currently selected category and player.
|
||||||
|
---@return string
|
||||||
function EID:ItemReminderGetDescription()
|
function EID:ItemReminderGetDescription()
|
||||||
EID.InsideItemReminder = true
|
EID.InsideItemReminder = true
|
||||||
EID.ItemReminderTempDescriptions = {}
|
EID.ItemReminderTempDescriptions = {}
|
||||||
|
|||||||
@@ -8,8 +8,15 @@ EID.TabDescThisFrame = false
|
|||||||
-- Some modifiers (e.g. Glitched Crown) want to know if Tab was pressed/released, rather than held
|
-- Some modifiers (e.g. Glitched Crown) want to know if Tab was pressed/released, rather than held
|
||||||
EID.TabHeldThisFrame = false
|
EID.TabHeldThisFrame = false
|
||||||
EID.TabHeldLastFrame = false
|
EID.TabHeldLastFrame = false
|
||||||
function EID:TabPressed() return EID.TabHeldThisFrame and not EID.TabHeldLastFrame end
|
|
||||||
function EID:TabReleased() return EID.TabHeldLastFrame and not EID.TabHeldThisFrame end
|
-- Returns true if Tab was pressed this frame, false otherwise
|
||||||
|
function EID:TabPressed()
|
||||||
|
return EID.TabHeldThisFrame and not EID.TabHeldLastFrame
|
||||||
|
end
|
||||||
|
-- Returns true if Tab was released this frame, false otherwise
|
||||||
|
function EID:TabReleased()
|
||||||
|
return EID.TabHeldLastFrame and not EID.TabHeldThisFrame
|
||||||
|
end
|
||||||
|
|
||||||
-- List of collectible IDs for us to check if a player owns them; feel free to add to this in mods that add description modifiers!
|
-- List of collectible IDs for us to check if a player owns them; feel free to add to this in mods that add description modifiers!
|
||||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_VOID] = true
|
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_VOID] = true
|
||||||
@@ -32,6 +39,7 @@ EID.collectiblesOwned = {}
|
|||||||
EID.collectiblesAbsorbed = {}
|
EID.collectiblesAbsorbed = {}
|
||||||
|
|
||||||
EID.LastCollectibleCheck = 0
|
EID.LastCollectibleCheck = 0
|
||||||
|
-- Check if any players own a collectible, returns true if at least one player has it
|
||||||
function EID:CheckPlayersCollectibles()
|
function EID:CheckPlayersCollectibles()
|
||||||
-- recheck the players' owned collectibles periodically, not every frame
|
-- recheck the players' owned collectibles periodically, not every frame
|
||||||
-- (has to be checked regularly due to mechanics like D4 / Tainted Eden)
|
-- (has to be checked regularly due to mechanics like D4 / Tainted Eden)
|
||||||
|
|||||||
@@ -86,6 +86,12 @@ local hudBBSprite = Sprite()
|
|||||||
hudBBSprite:Load("gfx/eid_transform_icons.anm2", true)
|
hudBBSprite:Load("gfx/eid_transform_icons.anm2", true)
|
||||||
hudBBSprite:Play("boundingBox")
|
hudBBSprite:Play("boundingBox")
|
||||||
|
|
||||||
|
local questionMarkSprite = Sprite()
|
||||||
|
questionMarkSprite:Load("gfx/005.100_collectible.anm2",true)
|
||||||
|
questionMarkSprite:ReplaceSpritesheet(1,"gfx/items/collectibles/questionmark.png")
|
||||||
|
questionMarkSprite:LoadGraphics()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EID.ModIndicator = { }
|
EID.ModIndicator = { }
|
||||||
-- Overwriting "RegisterMod" to track which mods are loading
|
-- Overwriting "RegisterMod" to track which mods are loading
|
||||||
@@ -133,6 +139,8 @@ local nullVector = Vector(0,0)
|
|||||||
------------------------------- Load Font ---------------------------------
|
------------------------------- Load Font ---------------------------------
|
||||||
local modfolder ='external item descriptions_836319872' --release mod folder name
|
local modfolder ='external item descriptions_836319872' --release mod folder name
|
||||||
|
|
||||||
|
--- Function to get the current mod path
|
||||||
|
--- @return string The absolute path to the current mod
|
||||||
function EID:GetCurrentModPath()
|
function EID:GetCurrentModPath()
|
||||||
if debug then
|
if debug then
|
||||||
return string.sub(debug.getinfo(EID.GetCurrentModPath).source,2) .. "/../"
|
return string.sub(debug.getinfo(EID.GetCurrentModPath).source,2) .. "/../"
|
||||||
@@ -173,8 +181,7 @@ if not success then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
--- Function to reset all floor trackers when a new floor is entered
|
||||||
-------------Handle Resetting Floor Trackers--------------
|
|
||||||
function EID:onNewFloor()
|
function EID:onNewFloor()
|
||||||
pathsChecked = {}
|
pathsChecked = {}
|
||||||
if EID.isRepentance then
|
if EID.isRepentance then
|
||||||
@@ -187,14 +194,7 @@ function EID:onNewFloor()
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, EID.onNewFloor)
|
EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, EID.onNewFloor)
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
--- Function to check if a collectible pedestal is an alt path choice
|
||||||
------------------------Handle ALT FLOOR CHOICE----------------------------
|
|
||||||
|
|
||||||
local questionMarkSprite = Sprite()
|
|
||||||
questionMarkSprite:Load("gfx/005.100_collectible.anm2",true)
|
|
||||||
questionMarkSprite:ReplaceSpritesheet(1,"gfx/items/collectibles/questionmark.png")
|
|
||||||
questionMarkSprite:LoadGraphics()
|
|
||||||
|
|
||||||
function EID:IsAltChoice(pickup)
|
function EID:IsAltChoice(pickup)
|
||||||
-- do not run this while Curse of the Blind is active, since this function is really just a "is collectible pedestal a red question mark" check
|
-- do not run this while Curse of the Blind is active, since this function is really just a "is collectible pedestal a red question mark" check
|
||||||
if not EID.isRepentance or EID:hasCurseBlind() then
|
if not EID.isRepentance or EID:hasCurseBlind() then
|
||||||
@@ -250,6 +250,9 @@ if EID.isRepentance then
|
|||||||
local lastGetItemResult = {nil, nil, nil, nil} -- itemID, Frame, gridIndex, InitSeed
|
local lastGetItemResult = {nil, nil, nil, nil} -- itemID, Frame, gridIndex, InitSeed
|
||||||
local lastFrameGridChecked = 0
|
local lastFrameGridChecked = 0
|
||||||
|
|
||||||
|
--- Handle Flip Item positions and Crane Game item positions. Repentance Only function!
|
||||||
|
---@param selectedCollectible number
|
||||||
|
---@param itemPoolType number
|
||||||
function EID:postGetCollectible(selectedCollectible, itemPoolType)
|
function EID:postGetCollectible(selectedCollectible, itemPoolType)
|
||||||
-- Handle Crane Game
|
-- Handle Crane Game
|
||||||
if itemPoolType == ItemPoolType.POOL_CRANE_GAME then
|
if itemPoolType == ItemPoolType.POOL_CRANE_GAME then
|
||||||
@@ -284,7 +287,11 @@ if EID.isRepentance then
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_GET_COLLECTIBLE, EID.postGetCollectible)
|
EID:AddCallback(ModCallbacks.MC_POST_GET_COLLECTIBLE, EID.postGetCollectible)
|
||||||
|
|
||||||
-- Handle Flip Item spawn
|
--- Pre Room Entity Spawn callback to handle Flip item and pedestal spawning. Repentance Only function!
|
||||||
|
---@param entityType any
|
||||||
|
---@param variant any
|
||||||
|
---@param subtype any
|
||||||
|
---@param gridIndex any
|
||||||
function EID:preRoomEntitySpawn(entityType, variant, subtype, gridIndex)
|
function EID:preRoomEntitySpawn(entityType, variant, subtype, gridIndex)
|
||||||
flipItemNext = false
|
flipItemNext = false
|
||||||
if entityType == 6 and variant == 14 then
|
if entityType == 6 and variant == 14 then
|
||||||
@@ -299,6 +306,8 @@ if EID.isRepentance then
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_PRE_ROOM_ENTITY_SPAWN, EID.preRoomEntitySpawn)
|
EID:AddCallback(ModCallbacks.MC_PRE_ROOM_ENTITY_SPAWN, EID.preRoomEntitySpawn)
|
||||||
|
|
||||||
|
--- Post Pickup Init callback to handle Flip item initialization. Repentance Only function!
|
||||||
|
---@param entity any
|
||||||
function EID:postPickupInitFlip(entity)
|
function EID:postPickupInitFlip(entity)
|
||||||
initialItemNext = false
|
initialItemNext = false
|
||||||
flipItemNext = true
|
flipItemNext = true
|
||||||
@@ -327,6 +336,8 @@ if EID.isRepentance then
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInitFlip, PickupVariant.PICKUP_COLLECTIBLE)
|
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInitFlip, PickupVariant.PICKUP_COLLECTIBLE)
|
||||||
|
|
||||||
|
--- Check if a pedestal's index is valid for Flip items. Repentance Only function!
|
||||||
|
---@param entity any
|
||||||
function EID:CheckPedestalIndex(entity)
|
function EID:CheckPedestalIndex(entity)
|
||||||
-- Only pedestals with indexes that were present at room load can be flip pedestals
|
-- Only pedestals with indexes that were present at room load can be flip pedestals
|
||||||
-- Fixes shop restock machines and Diplopia... mostly. At least while you're in the room.
|
-- Fixes shop restock machines and Diplopia... mostly. At least while you're in the room.
|
||||||
@@ -342,6 +353,7 @@ if EID.isRepentance then
|
|||||||
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.CheckPedestalIndex, PickupVariant.PICKUP_COLLECTIBLE)
|
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.CheckPedestalIndex, PickupVariant.PICKUP_COLLECTIBLE)
|
||||||
|
|
||||||
-- Before using Flip, swap all flippable pedestal's current item with the flip one (also, fix grid index if needed)
|
-- Before using Flip, swap all flippable pedestal's current item with the flip one (also, fix grid index if needed)
|
||||||
|
-- Repentance only function!
|
||||||
function EID:CheckFlipGridIndexes(collectibleType)
|
function EID:CheckFlipGridIndexes(collectibleType)
|
||||||
-- also, reload our descriptions due to transformation progress changing upon Flip
|
-- also, reload our descriptions due to transformation progress changing upon Flip
|
||||||
EID.ForceRefreshCache = true
|
EID.ForceRefreshCache = true
|
||||||
@@ -366,7 +378,7 @@ if EID.isRepentance then
|
|||||||
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.CheckFlipGridIndexes, CollectibleType.COLLECTIBLE_FLIP)
|
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.CheckFlipGridIndexes, CollectibleType.COLLECTIBLE_FLIP)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Watch for a Void absorbing active items
|
-- MC_PRE_USE_ITEM callback to watch for Void absorbing active items
|
||||||
function EID:CheckVoidAbsorbs(_, _, player)
|
function EID:CheckVoidAbsorbs(_, _, player)
|
||||||
player = player or EID.player
|
player = player or EID.player
|
||||||
local playerID = EID:getPlayerID(player, true)
|
local playerID = EID:getPlayerID(player, true)
|
||||||
@@ -453,6 +465,7 @@ EID.CachedRenderPoses = {}
|
|||||||
EID.descriptionsToPrint = {}
|
EID.descriptionsToPrint = {}
|
||||||
EID.entitiesToPrint = {}
|
EID.entitiesToPrint = {}
|
||||||
|
|
||||||
|
--- Reset the description cache, used when options change or when printing descriptions
|
||||||
function EID:ResetDescCache()
|
function EID:ResetDescCache()
|
||||||
EID.CachedIcons = {}
|
EID.CachedIcons = {}
|
||||||
EID.CachedStrings = {}
|
EID.CachedStrings = {}
|
||||||
@@ -461,7 +474,9 @@ function EID:ResetDescCache()
|
|||||||
EID.previousDescs = {}
|
EID.previousDescs = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a description to the print queue
|
||||||
|
---@param desc EID_DescObj | table -- The description object to add
|
||||||
|
---@param insertLoc integer | nil
|
||||||
function EID:addDescriptionToPrint(desc, insertLoc)
|
function EID:addDescriptionToPrint(desc, insertLoc)
|
||||||
if desc.Entity and EID.entitiesToPrint[GetPtrHash(desc.Entity)] then return end
|
if desc.Entity and EID.entitiesToPrint[GetPtrHash(desc.Entity)] then return end
|
||||||
if #EID.descriptionsToPrint == EID.Config["MaxDescriptionsToDisplay"] and not insertLoc then return end
|
if #EID.descriptionsToPrint == EID.Config["MaxDescriptionsToDisplay"] and not insertLoc then return end
|
||||||
@@ -472,12 +487,17 @@ function EID:addDescriptionToPrint(desc, insertLoc)
|
|||||||
if desc.Entity then EID.entitiesToPrint[GetPtrHash(desc.Entity)] = true end
|
if desc.Entity then EID.entitiesToPrint[GetPtrHash(desc.Entity)] = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a question mark description to the print queue
|
||||||
|
---@param entity Entity
|
||||||
|
---@param description string | nil
|
||||||
function EID:addQuestionMarkDescription(entity, description)
|
function EID:addQuestionMarkDescription(entity, description)
|
||||||
EID:addDescriptionToPrint({ Icon = EID.InlineIcons["QuestionMark"], Description = description or "", Entity = entity})
|
EID:addDescriptionToPrint({ Icon = EID.InlineIcons["QuestionMark"], Description = description or "", Entity = entity})
|
||||||
end
|
end
|
||||||
|
|
||||||
local prevPrintFrame = 0
|
local prevPrintFrame = 0
|
||||||
|
|
||||||
|
--- Print all descriptions that are currently in the description table
|
||||||
|
--- @param useCached boolean | nil - If true, will use the cached descriptions instead of printing new ones
|
||||||
function EID:printDescriptions(useCached)
|
function EID:printDescriptions(useCached)
|
||||||
prevPrintFrame = EID.GameRenderCount
|
prevPrintFrame = EID.GameRenderCount
|
||||||
|
|
||||||
@@ -513,6 +533,7 @@ function EID:printDescriptions(useCached)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Print all descriptions that are currently in the description table
|
||||||
function EID:printNewDescriptions()
|
function EID:printNewDescriptions()
|
||||||
EID.CachingDescription = true
|
EID.CachingDescription = true
|
||||||
EID:ResetDescCache()
|
EID:ResetDescCache()
|
||||||
@@ -533,11 +554,14 @@ function EID:printNewDescriptions()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Prints a description to the screen
|
||||||
|
---@param desc EID_DescObj
|
||||||
|
---@param cachedID integer | nil -- If this is a cached description, pass the index of the cached description
|
||||||
function EID:printDescription(desc, cachedID)
|
function EID:printDescription(desc, cachedID)
|
||||||
EID:PositionLocalMode(desc.Entity)
|
EID:PositionLocalMode(desc.Entity)
|
||||||
-- Do not print this description if it has to be drawn in the top-left and we've already drawn a top-left desc this frame
|
-- Do not print this description if it has to be drawn in the top-left and we've already drawn a top-left desc this frame
|
||||||
if EID.CurrentScaleType == "Size" then
|
if EID.CurrentScaleType == "Size" then
|
||||||
if alwaysUseLocalMode then return false
|
if alwaysUseLocalMode then return
|
||||||
else alwaysUseLocalMode = true end
|
else alwaysUseLocalMode = true end
|
||||||
end
|
end
|
||||||
EID.isDisplaying = true
|
EID.isDisplaying = true
|
||||||
@@ -716,6 +740,10 @@ function EID:printDescription(desc, cachedID)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Prints bullet points from a description string
|
||||||
|
---@param description string - The description string to print
|
||||||
|
---@param renderPos Vector - The position to render the bullet points at
|
||||||
|
---@param ignoreBPConfig boolean - If true, will ignore the bullet point icon configuration
|
||||||
function EID:printBulletPoints(description, renderPos, ignoreBPConfig)
|
function EID:printBulletPoints(description, renderPos, ignoreBPConfig)
|
||||||
local textboxWidth = tonumber(EID.Config["TextboxWidth"])
|
local textboxWidth = tonumber(EID.Config["TextboxWidth"])
|
||||||
local textScale = Vector(EID.Scale, EID.Scale)
|
local textScale = Vector(EID.Scale, EID.Scale)
|
||||||
@@ -752,6 +780,7 @@ end
|
|||||||
EID.isMirrorRoom = false
|
EID.isMirrorRoom = false
|
||||||
EID.isDeathCertRoom = false
|
EID.isDeathCertRoom = false
|
||||||
if EID.isRepentance then
|
if EID.isRepentance then
|
||||||
|
--- Handle Flip Item in New Room. Repentance only function!
|
||||||
function EID:AssignFlipItems()
|
function EID:AssignFlipItems()
|
||||||
EID.flipMaxIndex = -1
|
EID.flipMaxIndex = -1
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
||||||
@@ -766,6 +795,7 @@ if EID.isRepentance then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--- Handle MC_POST_NEW_ROOM for Repentance features
|
||||||
function EID:onNewRoomRep()
|
function EID:onNewRoomRep()
|
||||||
local level = game:GetLevel()
|
local level = game:GetLevel()
|
||||||
EID.isMirrorRoom = level:GetCurrentRoom():IsMirrorWorld()
|
EID.isMirrorRoom = level:GetCurrentRoom():IsMirrorWorld()
|
||||||
@@ -779,7 +809,7 @@ if EID.isRepentance then
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoomRep)
|
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoomRep)
|
||||||
end
|
end
|
||||||
|
--- MC_POST_NEW_ROOM callback to handle new rooms, mostly Glowing Hour Glass rewinding and Grid Entities
|
||||||
function EID:onNewRoom()
|
function EID:onNewRoom()
|
||||||
EID:CheckCurrentRoomGridEntities()
|
EID:CheckCurrentRoomGridEntities()
|
||||||
-- Store values here to be rewound after using Glowing Hour Glass
|
-- Store values here to be rewound after using Glowing Hour Glass
|
||||||
@@ -797,11 +827,15 @@ end
|
|||||||
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
|
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
---------------------------Handle Rendering--------------------------------
|
---------------------------Handle Rendering--------------------------------
|
||||||
|
-- RGB colors for each player's highlights (Red, Blue, Yellow, Green)
|
||||||
|
local playerRGB = { {1,0.6,0.6}, {0.5,0.75,1}, {0.9, 0.9, 0.5}, {0.5,1,0.75} }
|
||||||
|
|
||||||
|
--- Render an unidentified pill description
|
||||||
|
---@param entity Entity
|
||||||
function EID:renderUnidentifiedPill(entity)
|
function EID:renderUnidentifiedPill(entity)
|
||||||
EID:PositionLocalMode(entity)
|
EID:PositionLocalMode(entity)
|
||||||
if EID.CurrentScaleType == "Size" then
|
if EID.CurrentScaleType == "Size" then
|
||||||
if alwaysUseLocalMode then return false
|
if alwaysUseLocalMode then return
|
||||||
else alwaysUseLocalMode = true end
|
else alwaysUseLocalMode = true end
|
||||||
end
|
end
|
||||||
EID.isDisplaying = true
|
EID.isDisplaying = true
|
||||||
@@ -841,10 +875,9 @@ function EID:renderUnidentifiedPill(entity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- RGB colors for each player's highlights (Red, Blue, Yellow, Green)
|
--- Render an indicator for an entity, such as a highlight or arrow
|
||||||
local playerRGB = { {1,0.6,0.6}, {0.5,0.75,1}, {0.9, 0.9, 0.5}, {0.5,1,0.75} }
|
|
||||||
|
|
||||||
---@param entity Entity
|
---@param entity Entity
|
||||||
|
---@param playerNum integer - The player number to render the indicator for. Controls the arrow color
|
||||||
function EID:renderIndicator(entity, playerNum)
|
function EID:renderIndicator(entity, playerNum)
|
||||||
if EID.Config["Indicator"] == "none" then
|
if EID.Config["Indicator"] == "none" then
|
||||||
return
|
return
|
||||||
@@ -912,6 +945,7 @@ function EID:renderIndicator(entity, playerNum)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Position the description box in Local Mode, next to the item or entity
|
||||||
---@param entity Entity
|
---@param entity Entity
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function EID:PositionLocalMode(entity)
|
function EID:PositionLocalMode(entity)
|
||||||
@@ -944,6 +978,7 @@ function EID:PositionLocalMode(entity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Render HUD location indicators for debugging purposes
|
||||||
function EID:renderHUDLocationIndicators()
|
function EID:renderHUDLocationIndicators()
|
||||||
local mousePos = Isaac.WorldToRenderPosition(Input.GetMousePosition(true)) * 2
|
local mousePos = Isaac.WorldToRenderPosition(Input.GetMousePosition(true)) * 2
|
||||||
Isaac.RenderScaledText("Mouse pos X:"..mousePos.X.." Y:"..mousePos.Y, 100, 10, 0.5, 0.5, 1 ,1 ,1 ,1 )
|
Isaac.RenderScaledText("Mouse pos X:"..mousePos.X.." Y:"..mousePos.Y, 100, 10, 0.5, 0.5, 1 ,1 ,1 ,1 )
|
||||||
@@ -960,6 +995,8 @@ end
|
|||||||
local lastMousePos = Vector(0,0)
|
local lastMousePos = Vector(0,0)
|
||||||
local lastMouseMove = 0
|
local lastMouseMove = 0
|
||||||
|
|
||||||
|
--- Handle the HUD hover functionality, checking if the mouse is over any HUD elements
|
||||||
|
--- @return EID_DescObj | nil - Returns the description object if the mouse is over a HUD element, otherwise nil
|
||||||
function EID:handleHoverHUD()
|
function EID:handleHoverHUD()
|
||||||
local mousePos = Isaac.WorldToScreen(Input.GetMousePosition(true)) * 2
|
local mousePos = Isaac.WorldToScreen(Input.GetMousePosition(true)) * 2
|
||||||
if mousePos:Distance(lastMousePos) > 2 then
|
if mousePos:Distance(lastMousePos) > 2 then
|
||||||
@@ -982,6 +1019,7 @@ function EID:handleHoverHUD()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set the player and coop player data for EID
|
||||||
function EID:setPlayer()
|
function EID:setPlayer()
|
||||||
local numPlayers = game:GetNumPlayers()
|
local numPlayers = game:GetNumPlayers()
|
||||||
-- Old simple setPlayer, to reduce runtime in single player
|
-- Old simple setPlayer, to reduce runtime in single player
|
||||||
@@ -1034,12 +1072,13 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
---------------------------On Update Function------------------------------
|
---------------------------On Update Function------------------------------
|
||||||
-- Runs 30 times a second; doesn't update while paused
|
|
||||||
|
|
||||||
local collSpawned = false
|
local collSpawned = false
|
||||||
EID.RecheckVoid = false
|
EID.RecheckVoid = false
|
||||||
EID.ShouldCheckWisp = false
|
EID.ShouldCheckWisp = false
|
||||||
|
|
||||||
|
--- MC_POST_UPDATE callback that runs 30 times a second; doesn't update while paused
|
||||||
|
--- Handles updating the game state and checking for new items
|
||||||
function EID:onGameUpdate()
|
function EID:onGameUpdate()
|
||||||
EID.GameUpdateCount = EID.GameUpdateCount + 1
|
EID.GameUpdateCount = EID.GameUpdateCount + 1
|
||||||
EID:checkPlayersForMissingItems()
|
EID:checkPlayersForMissingItems()
|
||||||
@@ -1128,6 +1167,7 @@ local function attemptPathfind(entity)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local hasShownStartWarning = false
|
local hasShownStartWarning = false
|
||||||
|
--- Check for start of run warnings, such as old game version or modded items
|
||||||
function EID:CheckStartOfRunWarnings()
|
function EID:CheckStartOfRunWarnings()
|
||||||
if EID.isRepentance and not EID.Config["DisableStartOfRunWarnings"] and game:GetFrameCount() < 10*30 then
|
if EID.isRepentance and not EID.Config["DisableStartOfRunWarnings"] and game:GetFrameCount() < 10*30 then
|
||||||
-- Old Repentance version check; update this to check for the existence of the newest mod API function EID uses
|
-- Old Repentance version check; update this to check for the existence of the newest mod API function EID uses
|
||||||
@@ -1228,6 +1268,7 @@ EID.lastDist = 0
|
|||||||
EID.OptionChanged = false
|
EID.OptionChanged = false
|
||||||
EID.bagPlayer = nil
|
EID.bagPlayer = nil
|
||||||
|
|
||||||
|
--- Render function that runs every frame and handles the main EID rendering logic.
|
||||||
function EID:OnRender()
|
function EID:OnRender()
|
||||||
-- Increases by 60 per second, ignores pauses
|
-- Increases by 60 per second, ignores pauses
|
||||||
EID.GameRenderCount = EID.GameRenderCount + 1
|
EID.GameRenderCount = EID.GameRenderCount + 1
|
||||||
@@ -1614,6 +1655,9 @@ end
|
|||||||
|
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_RENDER, EID.OnRender)
|
EID:AddCallback(ModCallbacks.MC_POST_RENDER, EID.OnRender)
|
||||||
|
|
||||||
|
--- Add active item progress to the player's transformation progress.
|
||||||
|
---@param player EntityPlayer
|
||||||
|
---@param isD4 boolean
|
||||||
local function AddActiveItemProgress(player, isD4)
|
local function AddActiveItemProgress(player, isD4)
|
||||||
EID.ForceRefreshCache = true
|
EID.ForceRefreshCache = true
|
||||||
local playerID = EID:getPlayerID(player, true)
|
local playerID = EID:getPlayerID(player, true)
|
||||||
@@ -1635,10 +1679,12 @@ end
|
|||||||
-- Check the active items of every player for transformation progress (used at game start and after Genesis)
|
-- Check the active items of every player for transformation progress (used at game start and after Genesis)
|
||||||
local function CheckAllActiveItemProgress()
|
local function CheckAllActiveItemProgress()
|
||||||
for i = 0, game:GetNumPlayers() - 1 do
|
for i = 0, game:GetNumPlayers() - 1 do
|
||||||
AddActiveItemProgress(Isaac.GetPlayer(i))
|
AddActiveItemProgress(Isaac.GetPlayer(i), false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- OnGameStartGeneral is called when the game starts, either from a save or a new run.
|
||||||
|
--- It initializes various EID tables and resets item interactions.
|
||||||
local function OnGameStartGeneral(_,isSave)
|
local function OnGameStartGeneral(_,isSave)
|
||||||
EID:GetAllPassiveItems()
|
EID:GetAllPassiveItems()
|
||||||
EID:GetTransformationsOfModdedItems()
|
EID:GetTransformationsOfModdedItems()
|
||||||
@@ -1671,7 +1717,7 @@ local function OnUseD4(_, _, _, player)
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_USE_ITEM, OnUseD4, CollectibleType.COLLECTIBLE_D4)
|
EID:AddCallback(ModCallbacks.MC_USE_ITEM, OnUseD4, CollectibleType.COLLECTIBLE_D4)
|
||||||
|
|
||||||
-- Watch for smelting trinkets; includes Gulp and Marbles
|
-- MC_PRE_USE_ITEM callback to watch for smelting trinkets; includes Gulp and Marbles
|
||||||
function EID:OnUseSmelter(_, _, _, player)
|
function EID:OnUseSmelter(_, _, _, player)
|
||||||
player = player or EID.player
|
player = player or EID.player
|
||||||
local playerNum = EID:getPlayerID(player, true)
|
local playerNum = EID:getPlayerID(player, true)
|
||||||
@@ -1684,7 +1730,7 @@ function EID:OnUseSmelter(_, _, _, player)
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.OnUseSmelter, CollectibleType.COLLECTIBLE_SMELTER)
|
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.OnUseSmelter, CollectibleType.COLLECTIBLE_SMELTER)
|
||||||
|
|
||||||
-- Watch for Glowing Hourglass to revert certain variables
|
-- MC_PRE_USE_ITEM callback to watch for Glowing Hourglass to revert certain variables
|
||||||
local function OnUseGlowingHourglass(_, _, _, _)
|
local function OnUseGlowingHourglass(_, _, _, _)
|
||||||
EID.absorbedItems = EID:CopyTable(preHourglassStatus.absorbedItems)
|
EID.absorbedItems = EID:CopyTable(preHourglassStatus.absorbedItems)
|
||||||
EID.PlayerItemInteractions = EID:CopyTable(preHourglassStatus.PlayerItemInteractions)
|
EID.PlayerItemInteractions = EID:CopyTable(preHourglassStatus.PlayerItemInteractions)
|
||||||
@@ -1721,6 +1767,10 @@ if EID.isRepentance then
|
|||||||
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, OnUseGeneral)
|
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, OnUseGeneral)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- OnUsePill is called when a pill is used, and handles pill history tracking and Wild Card effects.
|
||||||
|
---@param pillEffectID number The ID of the pill effect being used.
|
||||||
|
---@param player EntityPlayer The player using the pill.
|
||||||
|
---@param useFlags number Flags indicating how the pill was used (e.g., whether it was used with no animation).
|
||||||
function EID:OnUsePill(pillEffectID, player, useFlags)
|
function EID:OnUsePill(pillEffectID, player, useFlags)
|
||||||
player = player or EID.player --AB+ doesn't receive player in callback arguments!
|
player = player or EID.player --AB+ doesn't receive player in callback arguments!
|
||||||
-- get the pill color by checking the player's pocket
|
-- get the pill color by checking the player's pocket
|
||||||
@@ -1743,6 +1793,10 @@ function EID:OnUsePill(pillEffectID, player, useFlags)
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill)
|
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill)
|
||||||
|
|
||||||
|
--- OnUseCard is called when a card is used, and handles card history tracking and Wild Card effects.
|
||||||
|
---@param cardID number The ID of the card being used.
|
||||||
|
---@param player EntityPlayer The player using the card.
|
||||||
|
---@param useFlags number Flags indicating how the card was used (e.g., whether it was used with no animation).
|
||||||
function EID:OnUseCard(cardID, player, useFlags)
|
function EID:OnUseCard(cardID, player, useFlags)
|
||||||
player = player or EID.player --AB+ doesn't receive player in callback arguments!
|
player = player or EID.player --AB+ doesn't receive player in callback arguments!
|
||||||
EID:AddPickupToHistory("card", cardID, player, useFlags)
|
EID:AddPickupToHistory("card", cardID, player, useFlags)
|
||||||
@@ -1771,6 +1825,11 @@ local configIgnoreList = {
|
|||||||
--------------------------------
|
--------------------------------
|
||||||
--------Handle Savedata---------
|
--------Handle Savedata---------
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
--- OnGameStart is called when the game starts, either from a save or a new run.
|
||||||
|
--- It initializes the config data if available.
|
||||||
|
---@param isSave boolean Indicates whether the game is starting from a save or a new run.
|
||||||
function EID:OnGameStart(isSave)
|
function EID:OnGameStart(isSave)
|
||||||
--Loading Moddata--
|
--Loading Moddata--
|
||||||
if EID:HasData() then
|
if EID:HasData() then
|
||||||
@@ -1881,7 +1940,7 @@ function EID:OnGameStart(isSave)
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, EID.OnGameStart)
|
EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, EID.OnGameStart)
|
||||||
|
|
||||||
--Saving Moddata--
|
--- OnGameExit saves the current EID configuration.
|
||||||
function EID:OnGameExit()
|
function EID:OnGameExit()
|
||||||
if EID.isRepentance then
|
if EID.isRepentance then
|
||||||
EID.Config["BagContent"] = EID.BoC.BagItems or {}
|
EID.Config["BagContent"] = EID.BoC.BagItems or {}
|
||||||
|
|||||||
Reference in new issue
Block a user