Added more comments to some functions

This commit is contained in:
Wofsauge committed 2025-06-11 00:23:18 +02:00
1 parent cf2a02b051
commit 5f6bb5a981
4 files changed
+138 -45

No files matched your search

+9 -4
View File
@@ -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 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 language? EID_LanguageCode @Default: "en"
-- Example: My modded trinket gives +0.5 range and when tripled, adds homing instead of tripling the range boost:
--- ```lua
--- EID:addGoldenTrinketMetadata(Isaac.GetTrinketIdByName("Cool Trinket"), {"", "Homing tears"}, 0.5, 2)
@@ -194,14 +195,15 @@ function EID:addGoldenTrinketMetadata(id, appendText, numbersToMultiply, maxMult
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
---@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 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 language? EID_LanguageCode @Default: "en"
-- Example: My modded trinket gives +5 range and when tripled, adds homing instead of tripling the range boost:
--- ```lua
--- EID:addGoldenTrinketMetadataAdditive(Isaac.GetTrinketIdByName("Cool Trinket"), {"", "Homing tears"}, 5, {1,2,3})
--- ```
function EID:addGoldenTrinketMetadataAdditive(id, appendText, numbersToChange, additiveValues, language)
language = language or "en"
@@ -223,7 +225,6 @@ end
---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.
---You may also want to add text entries into `EID.descriptions[languageCode].goldenTrinketEffects`
---<br><hr><br>
---@param id TrinketType
---@param dataTable EID_GoldenTrinketData
function EID:addGoldenTrinketTable(id, dataTable)
@@ -247,6 +248,8 @@ function EID:addCard(id, description, itemName, language)
end
-- DEPRECATED! Does nothing! Don't use!
---@deprecated
---@diagnostic disable-next-line: unused-local
function EID:addCardMetadata(id, mimicCharge, isRune)
end
@@ -292,6 +295,7 @@ end
---@param id PillEffect
---@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
---@diagnostic disable-next-line: unused-local
function EID:addPillMetadata(id, mimicCharge, class)
EID.pillMetadata[id] = {
class = class or "0",
@@ -1005,8 +1009,9 @@ function EID:getXMLDescription(Type, Variant, SubType)
end
---Check if an entity is part of the describable entities
---@param entity Entity
---@param entity Entity | GridEntity
---@return boolean
---@diagnostic disable: param-type-mismatch
---@diagnostic disable-next-line: duplicate-set-field
function EID:hasDescription(entity)
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)
---@param player EntityPlayer
---@param Type EntityType
---@param Type EntityType | string
---@param Var integer?
---@param Sub integer?
---@return boolean
+36 -15
View File
@@ -506,7 +506,8 @@ function EID:ItemReminderAddSpecialDescriptions(player)
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)
local playerType = player:GetPlayerType()
local playerDesc = EID:getDescriptionEntry("CharacterInfo")[playerType]
@@ -515,7 +516,8 @@ function EID:ItemReminderHandleCharacterInfo(player)
end
end
-- Passive Item Descriptions
-- Item Reminder function: Passive Item Descriptions
---@param player EntityPlayer
function EID:ItemReminderHandleSelectedPassiveItem(player)
local playerNum = EID:getPlayerID(player, true)
if EID.RecentlyTouchedItems[playerNum] and #EID.RecentlyTouchedItems[playerNum] > 0 then
@@ -523,7 +525,8 @@ function EID:ItemReminderHandleSelectedPassiveItem(player)
end
end
-- Active Item Descriptions
-- Item Reminder function: Active Item Descriptions
---@param player EntityPlayer
function EID:ItemReminderHandleActiveItems(player)
-- limit number of active item descriptions to 2, since Slot 3 and 4 are handled seperately
for i = 0, 1 do
@@ -536,7 +539,8 @@ function EID:ItemReminderHandleActiveItems(player)
end
end
-- pocket active
-- Item Reminder function: pocket actives
---@param player EntityPlayer
function EID:ItemReminderHandlePocketActive(player)
if not EID.isRepentance or not EID:ItemReminderCanAddMoreToView() then return end
local pocketActive = player:GetActiveItem(2) or 0
@@ -545,7 +549,8 @@ function EID:ItemReminderHandlePocketActive(player)
end
end
-- dice bag
-- Item Reminder function: dice bag
---@param player EntityPlayer
function EID:ItemReminderHandleDiceBag(player)
if not EID.isRepentance or not EID:ItemReminderCanAddMoreToView() then return end
@@ -555,7 +560,8 @@ function EID:ItemReminderHandleDiceBag(player)
end
end
-- Pocket Item Descriptions
-- Item Reminder function: Pocket Item Descriptions
---@param player EntityPlayer
function EID:ItemReminderHandlePocketItems(player)
for i = 0, 2 do
if not EID:ItemReminderCanAddMoreToView() then return end
@@ -576,7 +582,9 @@ function EID:ItemReminderHandlePocketItems(player)
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)
local playerNum = EID:getPlayerID(player, true)
local newTable = {}
@@ -587,12 +595,14 @@ function EID:ItemReminderHeldPlusGulped(player)
end
return newTable
end
-- Trinket Descriptions
-- Item Reminder function: Trinket Descriptions
---@param player EntityPlayer
function EID:ItemReminderHandleTrinkets(player)
EID:ItemReminderHandleItemPrinting(player, EID:ItemReminderHeldPlusGulped(player), 350, true)
end
-- Tainted ??? Poop Descriptions
-- Item Reminder function: Tainted ??? Poop Descriptions
---@param player EntityPlayer
function EID:ItemReminderHandlePoopSpells(player)
if EID.isRepentance and player:GetPlayerType() == 25 and EID:ItemReminderCanAddMoreToView() then
local poopInfo = EID:getDescriptionEntry("poopSpells")
@@ -646,13 +656,14 @@ function EID:ItemReminderHandlePoopSpells(player)
end
end
-- Lemegeton wisp descriptions
-- Item Reminder function: Lemegeton wisp descriptions
---@param player EntityPlayer
function EID:ItemReminderHandleLemegetonWisps(player)
local playerNum = EID:getPlayerID(player, true)
EID:ItemReminderHandleItemPrinting(player, EID.WispsPerPlayer[playerNum], 100, false)
end
-- Handle scroll inputs
-- Item Reminder function: Handle scroll inputs
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["ItemReminderDisableInputs"] then EID.holdTabPlayer.ControlsCooldown = 2 end
@@ -695,10 +706,10 @@ function EID:ItemReminderHandleInputs()
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()
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
table.insert(filteredPlayerList, player)
end
@@ -706,14 +717,20 @@ function EID:ItemReminderGetAllPlayers()
return filteredPlayerList
end
-- Item Reminder function: check if the currently selected category is scrollable
---@return boolean
function EID:IsScrollableCategorySelected()
return EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1].isScrollable
end
-- Item Reminder function: check if the given category is currently selected
---@param categoryID integer
---@return boolean
function EID:IsCategorySelected(categoryID)
return EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1].id == categoryID
end
-- Item Reminder function: Resets data when initializing holding TAB
function EID:ItemReminderHandleInitHoldTab()
local oldDisplayPlayer = EID.ItemReminderSelectedPlayer
@@ -734,6 +751,8 @@ function EID:ItemReminderHandleInitHoldTab()
end
end
--- Returns the title of the currently selected Item Reminder category.
---@return string
function EID:ItemReminderGetTitle()
local category = EID.ItemReminderCategories[EID.ItemReminderSelectedCategory + 1]
@@ -836,19 +855,21 @@ function EID:ItemReminderHandleItemPrinting(player, entryTable, itemVariant, des
if descending then
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)
startIndex = (startIndex - 1) % #entryTable
end
else
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)
startIndex = (startIndex + 1) % #entryTable
end
end
end
--- Generates the description for the Item Reminder, based on the currently selected category and player.
---@return string
function EID:ItemReminderGetDescription()
EID.InsideItemReminder = true
EID.ItemReminderTempDescriptions = {}
+10 -2
View File
@@ -8,8 +8,15 @@ EID.TabDescThisFrame = false
-- Some modifiers (e.g. Glitched Crown) want to know if Tab was pressed/released, rather than held
EID.TabHeldThisFrame = 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!
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_VOID] = true
@@ -32,6 +39,7 @@ EID.collectiblesOwned = {}
EID.collectiblesAbsorbed = {}
EID.LastCollectibleCheck = 0
-- Check if any players own a collectible, returns true if at least one player has it
function EID:CheckPlayersCollectibles()
-- recheck the players' owned collectibles periodically, not every frame
-- (has to be checked regularly due to mechanics like D4 / Tainted Eden)