Fixed Error when using card on Player init
This commit is contained in:
1 parent
106075dfd8
commit
1b01a4ceb5
2 files changed
+13
-15
No files matched your search
+12
-12
@@ -1674,14 +1674,8 @@ EID.PlayerItemInteractions = {}
|
|||||||
EID.RecentlyTouchedItems = {}
|
EID.RecentlyTouchedItems = {}
|
||||||
local hadQueuedItem = {}
|
local hadQueuedItem = {}
|
||||||
function EID:evaluateQueuedItems()
|
function EID:evaluateQueuedItems()
|
||||||
--initialize the interactions table for all players if it isn't already
|
|
||||||
for i = 0, game:GetNumPlayers() - 1 do
|
|
||||||
if not EID.PlayerItemInteractions[i] then
|
|
||||||
EID.PlayerItemInteractions[i] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, pickupHistory = {}, altPickupHistory = {}}
|
|
||||||
end
|
|
||||||
EID.RecentlyTouchedItems[i] = EID.RecentlyTouchedItems[i] or {}
|
|
||||||
end
|
|
||||||
for i = 0, game:GetNumPlayers() - 1 do
|
for i = 0, game:GetNumPlayers() - 1 do
|
||||||
|
EID:InitItemInteractionIfAbsent(i)
|
||||||
local player = Isaac.GetPlayer(i)
|
local player = Isaac.GetPlayer(i)
|
||||||
if player.QueuedItem then
|
if player.QueuedItem then
|
||||||
-- Refresh our descriptions upon a queued passive item being added to a player
|
-- Refresh our descriptions upon a queued passive item being added to a player
|
||||||
@@ -1703,7 +1697,6 @@ function EID:evaluateQueuedItems()
|
|||||||
-- A new active item was touched; initiate its touch count to 0 for all players
|
-- A new active item was touched; initiate its touch count to 0 for all players
|
||||||
-- (Fixes co-op bugs, compared to only initiating it for the toucher)
|
-- (Fixes co-op bugs, compared to only initiating it for the toucher)
|
||||||
for j = 0, game:GetNumPlayers() - 1 do
|
for j = 0, game:GetNumPlayers() - 1 do
|
||||||
local player = Isaac.GetPlayer(j)
|
|
||||||
EID.PlayerItemInteractions[j].actives[itemID] = EID.PlayerItemInteractions[j].actives[itemID] or 0
|
EID.PlayerItemInteractions[j].actives[itemID] = EID.PlayerItemInteractions[j].actives[itemID] or 0
|
||||||
EID.PlayerItemInteractions[j].altActives[itemID] = EID.PlayerItemInteractions[j].altActives[itemID] or 0
|
EID.PlayerItemInteractions[j].altActives[itemID] = EID.PlayerItemInteractions[j].altActives[itemID] or 0
|
||||||
end
|
end
|
||||||
@@ -1724,6 +1717,15 @@ function EID:evaluateQueuedItems()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- if the player ItemInteraction table doesnt exist, create it with its init values
|
||||||
|
function EID:InitItemInteractionIfAbsent(playerID)
|
||||||
|
if not EID.PlayerItemInteractions[playerID] then
|
||||||
|
EID.PlayerItemInteractions[playerID] = { LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {},
|
||||||
|
pickupHistory = {}, altPickupHistory = {} }
|
||||||
|
end
|
||||||
|
EID.RecentlyTouchedItems[playerID] = EID.RecentlyTouchedItems[playerID] or {}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Returns the quality of the described entity
|
-- Returns the quality of the described entity
|
||||||
function EID:getObjectQuality(descObj)
|
function EID:getObjectQuality(descObj)
|
||||||
@@ -1770,10 +1772,8 @@ end
|
|||||||
function EID:AddPickupToHistory(pickupType, effectID, player, useFlags)
|
function EID:AddPickupToHistory(pickupType, effectID, player, useFlags)
|
||||||
if REPENTANCE and useFlags & UseFlag.USE_MIMIC == UseFlag.USE_MIMIC then return end -- dont add mimic pills to history
|
if REPENTANCE and useFlags & UseFlag.USE_MIMIC == UseFlag.USE_MIMIC then return end -- dont add mimic pills to history
|
||||||
local playerID = EID:getPlayerID(player)
|
local playerID = EID:getPlayerID(player)
|
||||||
if not EID.PlayerItemInteractions[playerID].pickupHistory then
|
EID:InitItemInteractionIfAbsent(playerID)
|
||||||
EID.PlayerItemInteractions[playerID].pickupHistory = {}
|
|
||||||
EID.PlayerItemInteractions[playerID].altPickupHistory = {}
|
|
||||||
end
|
|
||||||
local historyTable = EID.PlayerItemInteractions[playerID].pickupHistory
|
local historyTable = EID.PlayerItemInteractions[playerID].pickupHistory
|
||||||
-- Dead Tainted Lazarus exception
|
-- Dead Tainted Lazarus exception
|
||||||
if player:GetPlayerType() == 38 then
|
if player:GetPlayerType() == 38 then
|
||||||
|
|||||||
@@ -1522,9 +1522,7 @@ EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)
|
|||||||
local function AddActiveItemProgress(player, isD4)
|
local function AddActiveItemProgress(player, isD4)
|
||||||
EID.ForceRefreshCache = true
|
EID.ForceRefreshCache = true
|
||||||
local playerID = EID:getPlayerID(player)
|
local playerID = EID:getPlayerID(player)
|
||||||
if not EID.PlayerItemInteractions[playerID] then
|
EID:InitItemInteractionIfAbsent(playerID)
|
||||||
EID.PlayerItemInteractions[playerID] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, pickupHistory = {}, altPickupHistory = {}}
|
|
||||||
end
|
|
||||||
-- Dead Tainted Lazarus exceptions
|
-- Dead Tainted Lazarus exceptions
|
||||||
local activesTable = EID.PlayerItemInteractions[playerID].actives
|
local activesTable = EID.PlayerItemInteractions[playerID].actives
|
||||||
if player:GetPlayerType() == 38 then
|
if player:GetPlayerType() == 38 then
|
||||||
|
|||||||
Reference in new issue
Block a user