improving pill usage tracking

This commit is contained in:
Buurazu authored and GitHub committed 2023-05-06 19:02:42 -04:00
1 parent 33121b3d84
commit 9102104be8
1 file changed
+5 -4
+5 -4
View File
@@ -1599,15 +1599,16 @@ 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)
-- get the pill color by checking the player's pocket
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
-- add the pill used to our history for Echo Chamber / Vurp! / transformation progress
EID:AddPickupToHistory("pill", pillEffectID+1, player, useFlags, pillColor)
EID.ForceRefreshCache = true -- for transformation progress update
-- 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 EID.isRepentance and (pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD or useFlags == UseFlag.USE_NOANNOUNCER) then return end
EID.UsedPillColors[tostring(pillColor)] = true
end
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill)