Fix player param pass to EID:OnUseSmelter (#914)

This commit is contained in:
fly_6 authored and GitHub committed 2025-09-16 22:54:01 +02:00
1 parent 142d6b1382
commit 17c47791a9
1 file changed
+14 -14
+14 -14
View File
@@ -1084,7 +1084,7 @@ function EID:onGameUpdate()
EID:checkPlayersForMissingItems() EID:checkPlayersForMissingItems()
EID:evaluateQueuedItems() EID:evaluateQueuedItems()
EID:evaluateHeldPill() EID:evaluateHeldPill()
EID.TabHeldLastFrame = EID.TabHeldThisFrame EID.TabHeldLastFrame = EID.TabHeldThisFrame
EID.TabHeldThisFrame = EID:PlayersActionPressed(EID.Config["BagOfCraftingToggleKey"]) EID.TabHeldThisFrame = EID:PlayersActionPressed(EID.Config["BagOfCraftingToggleKey"])
@@ -1108,14 +1108,14 @@ function EID:onGameUpdate()
EID.RecheckVoid = true EID.RecheckVoid = true
end end
-- Check player items for starting items -- Check player items for starting items
if EID.ShouldCheckStartingItems then if EID.ShouldCheckStartingItems then
EID:UpdateAllPlayerPassiveItems() EID:UpdateAllPlayerPassiveItems()
EID:SetOldestItemIndex() EID:SetOldestItemIndex()
EID.ShouldCheckStartingItems = false EID.ShouldCheckStartingItems = false
end end
if EID.isRepentance then if EID.isRepentance then
EID:WatchForGlitchedCrown() EID:WatchForGlitchedCrown()
EID:UpdateWildCardEffects() EID:UpdateWildCardEffects()
@@ -1205,7 +1205,7 @@ end
function EID:CheckPosModifiers() function EID:CheckPosModifiers()
-- HUD offset adjustment, done every frame so it looks nice while changing the option -- HUD offset adjustment, done every frame so it looks nice while changing the option
if Options then if Options then
-- Read the HUD offset from the Options table if it exists. -- Read the HUD offset from the Options table if it exists.
-- +3 Y to avoid overlapping with the shadow of the charge bar hud -- +3 Y to avoid overlapping with the shadow of the charge bar hud
EID:addTextPosModifier("HudOffset", Vector(20, 12) * (Options.HUDOffset - 1) + Vector(0, 3)) EID:addTextPosModifier("HudOffset", Vector(20, 12) * (Options.HUDOffset - 1) + Vector(0, 3))
else else
@@ -1513,7 +1513,7 @@ function EID:OnRender()
EID:addDescriptionToPrint(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1, closest)) EID:addDescriptionToPrint(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1, closest))
-- Handle Card Reading Portals -- Handle Card Reading Portals
elseif closest.Type == 1000 and closest.Variant == 161 then elseif closest.Type == 1000 and closest.Variant == 161 then
if closest.SubType <= 2 or (EID.isRepentancePlus and closest.SubType == 3) then if closest.SubType <= 2 or (EID.isRepentancePlus and closest.SubType == 3) then
local subtypeToCard = {18, 5, 19} local subtypeToCard = {18, 5, 19}
if EID.isRepentancePlus then if EID.isRepentancePlus then
subtypeToCard = {18, 5, 19, 10} subtypeToCard = {18, 5, 19, 10}
@@ -1538,7 +1538,7 @@ function EID:OnRender()
if EID:getEntityData(closest, "EID_DontHide") ~= true then if EID:getEntityData(closest, "EID_DontHide") ~= true then
local isHideUncollected = EID.Config["HideUncollectedItemDescriptions"] and EID:requiredForCollectionPage(collectibleID) local isHideUncollected = EID.Config["HideUncollectedItemDescriptions"] and EID:requiredForCollectionPage(collectibleID)
if (EID.Config["DisableOnCurse"] and EID:hasCurseBlind()) or (isHideUncollected) or (EID.Config["DisableOnAprilFoolsChallenge"] and game.Challenge == Challenge.CHALLENGE_APRILS_FOOL) then if (EID.Config["DisableOnCurse"] and EID:hasCurseBlind()) or (isHideUncollected) or (EID.Config["DisableOnAprilFoolsChallenge"] and game.Challenge == Challenge.CHALLENGE_APRILS_FOOL) then
local description = isHideUncollected and EID:getDescriptionEntry("CollectionPageInfo") or nil local description = isHideUncollected and EID:getDescriptionEntry("CollectionPageInfo") or nil
EID:addQuestionMarkDescription(closest, description) EID:addQuestionMarkDescription(closest, description)
wasHidden = true; wasHidden = true;
end end
@@ -1720,10 +1720,10 @@ end
EID:AddCallback(ModCallbacks.MC_USE_ITEM, OnUseD4, CollectibleType.COLLECTIBLE_D4) EID:AddCallback(ModCallbacks.MC_USE_ITEM, OnUseD4, CollectibleType.COLLECTIBLE_D4)
-- MC_PRE_USE_ITEM callback to 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)
EID.GulpedTrinkets[playerNum] = EID.GulpedTrinkets[playerNum] or {} EID.GulpedTrinkets[playerNum] = EID.GulpedTrinkets[playerNum] or {}
for i=0,1 do for i=0,1 do
local trinket = player:GetTrinket(i) local trinket = player:GetTrinket(i)
@@ -1836,7 +1836,7 @@ function EID:OnGameStart(isSave)
--Loading Moddata-- --Loading Moddata--
if EID:HasData() then if EID:HasData() then
local savedEIDConfig = json.decode(Isaac.LoadModData(EID)) local savedEIDConfig = json.decode(Isaac.LoadModData(EID))
-- JSON saves integer table keys as strings. we need to transform them back... used in OnGameStart -- JSON saves integer table keys as strings. we need to transform them back... used in OnGameStart
local function ConvertSavedTable(tableName) local function ConvertSavedTable(tableName)
for playerID, data in pairs(savedEIDConfig[tableName] or {}) do for playerID, data in pairs(savedEIDConfig[tableName] or {}) do
@@ -1851,7 +1851,7 @@ function EID:OnGameStart(isSave)
EID[tableName][tonumber(playerID)] = convertedData EID[tableName][tonumber(playerID)] = convertedData
end end
end end
-- collection progress -- collection progress
EID.CollectedItems = savedEIDConfig["CollectedItems"] or {} EID.CollectedItems = savedEIDConfig["CollectedItems"] or {}
if EID.SaveGame and savedEIDConfig["SaveGameNumber"] > 0 then if EID.SaveGame and savedEIDConfig["SaveGameNumber"] > 0 then
@@ -1878,19 +1878,19 @@ function EID:OnGameStart(isSave)
EID.UsedPillColors = savedEIDConfig["UsedPillColors"] or {} EID.UsedPillColors = savedEIDConfig["UsedPillColors"] or {}
EID.absorbedItems = savedEIDConfig["AbsorbedItems"] or {} EID.absorbedItems = savedEIDConfig["AbsorbedItems"] or {}
end end
if EID.isRepentance then if EID.isRepentance then
EID.BoC.BagItems = {} EID.BoC.BagItems = {}
EID.BoC.LearnedRecipes = {} EID.BoC.LearnedRecipes = {}
EID.CraneItemType = {} EID.CraneItemType = {}
EID.flipItemPositions = {} EID.flipItemPositions = {}
if isSave then if isSave then
EID.BoC.BagItems = savedEIDConfig["BagContent"] or {} EID.BoC.BagItems = savedEIDConfig["BagContent"] or {}
EID.BoC.LearnedRecipes = savedEIDConfig["BagLearnedRecipes"] or {} EID.BoC.LearnedRecipes = savedEIDConfig["BagLearnedRecipes"] or {}
EID.BoC.RoomQueries = savedEIDConfig["BagFloorContent"] or {} EID.BoC.RoomQueries = savedEIDConfig["BagFloorContent"] or {}
EID.CraneItemType = savedEIDConfig["CraneItemType"] or {} EID.CraneItemType = savedEIDConfig["CraneItemType"] or {}
-- turn list back into dict because json cant save dict indices. -- turn list back into dict because json cant save dict indices.
local flipItemTable = {} local flipItemTable = {}
for _, v in ipairs(savedEIDConfig["FlipItemPositions"]) do for _, v in ipairs(savedEIDConfig["FlipItemPositions"]) do
@@ -1934,7 +1934,7 @@ function EID:OnGameStart(isSave)
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
EID.Scale = EID.Config["Size"] EID.Scale = EID.Config["Size"]
EID.ItemReminderSelectedCategory = EID.Config["ItemReminderDisplayMode"] == "NoOverview" and 1 or 0 EID.ItemReminderSelectedCategory = EID.Config["ItemReminderDisplayMode"] == "NoOverview" and 1 or 0
EID:AdjustLanguageConfigSetting() EID:AdjustLanguageConfigSetting()
EID:fixDefinedFont() EID:fixDefinedFont()
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt") EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")