Fixed Pill usage not being tracked correctly anymore
This commit is contained in:
1 parent
7a240b5dd3
commit
73b10108c3
2 files changed
+31
-6
No files matched your search
+29
-4
@@ -1681,12 +1681,27 @@ function EID:evaluateTransformationProgress(transformation)
|
||||
if transformData and transformData.VanillaForm and player:HasPlayerForm(transformData.VanillaForm) then
|
||||
EID.TransformationProgress[i][transformation] = transformData.NumNeeded or 3
|
||||
else
|
||||
-- Dead Tainted Lazarus exceptions
|
||||
local pickupHistory = EID.PlayerItemInteractions[i].pickupHistory
|
||||
local pillsTable = {}
|
||||
-- Dead Tainted Lazarus exception
|
||||
if player:GetPlayerType() == 38 then
|
||||
pickupHistory = EID.PlayerItemInteractions[i].altPickupHistory or pickupHistory
|
||||
end
|
||||
if pickupHistory then
|
||||
for j = 1, #pickupHistory do
|
||||
if pickupHistory[j][1] == "pill" then
|
||||
local pillSubType = tostring(pickupHistory[j][3])
|
||||
if not pillsTable[pillSubType] then
|
||||
pillsTable[pillSubType] = 0
|
||||
end
|
||||
pillsTable[pillSubType] = pillsTable[pillSubType] + 1 -- collect pill SubType
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local activesTable = EID.PlayerItemInteractions[i].actives
|
||||
local pillsTable = EID.PlayerItemInteractions[i].pills
|
||||
if player:GetPlayerType() == 38 then
|
||||
activesTable = EID.PlayerItemInteractions[i].altActives or activesTable
|
||||
pillsTable = EID.PlayerItemInteractions[i].altPills or pillsTable
|
||||
end
|
||||
for entityString, _ in pairs(EID.TransformationLookup[transformation]) do
|
||||
local eType, eVariant, eSubType = entityString:match("([^.]+).([^.]+).([^.]+)")
|
||||
@@ -1716,6 +1731,16 @@ function EID:evaluateTransformationProgress(transformation)
|
||||
end
|
||||
end
|
||||
|
||||
-- Workaround function to get the currently held pill of the players. Used to map Pill ID to pill color and vise versa
|
||||
EID.PlayerHeldPill = {}
|
||||
function EID:evaluateHeldPill()
|
||||
EID.PlayerHeldPill = {}
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
EID.PlayerHeldPill[i] = player:GetPill(0)
|
||||
end
|
||||
end
|
||||
|
||||
-- Watch for a player's queued item (holding an item over their head) to track active item touches
|
||||
-- Used for Transformation Progress and for tracking Recently Touched Items
|
||||
EID.PlayerItemInteractions = {}
|
||||
@@ -1768,7 +1793,7 @@ 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 = {},
|
||||
EID.PlayerItemInteractions[playerID] = { LastTouch = 0, actives = {}, altActives = {},
|
||||
pickupHistory = {}, altPickupHistory = {}, rerollItems = {} }
|
||||
end
|
||||
EID.RecentlyTouchedItems[playerID] = EID.RecentlyTouchedItems[playerID] or {}
|
||||
|
||||
@@ -991,6 +991,7 @@ function EID:onGameUpdate()
|
||||
EID.GameUpdateCount = EID.GameUpdateCount + 1
|
||||
EID:checkPlayersForMissingItems()
|
||||
EID:evaluateQueuedItems()
|
||||
EID:evaluateHeldPill()
|
||||
|
||||
-- Fix some outdated mods erroneously setting the REPENTANCE constant to false
|
||||
if EID.GameVersion == "rep" and REPENTANCE == false then
|
||||
@@ -1577,10 +1578,9 @@ end
|
||||
function EID:OnUsePill(pillEffectID, player, useFlags)
|
||||
player = player or EID.player --AB+ doesn't receive player in callback arguments!
|
||||
-- get the pill color by checking the player's pocket (not accurate for Temperance? and such, but useFlags will help us ignore those)
|
||||
local pillColor = player:GetPill(0)
|
||||
local pillColor = EID.PlayerHeldPill[EID:getPlayerID(player)]
|
||||
if pillColor == 0 then return end -- ignore if no pill found in pocket
|
||||
EID:AddPickupToHistory("pill", pillEffectID+1, player, useFlags, pillColor) -- Echo Chamber tracking
|
||||
|
||||
-- for tracking used pills, ignore gold pills and noannouncer flag pills
|
||||
-- (not using a bitmask, because Placebo is mimic+noannouncer, and we want to count those)
|
||||
if REPENTANCE and (pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD or useFlags == UseFlag.USE_NOANNOUNCER) then return end
|
||||
|
||||
Reference in new issue
Block a user