improving pill usage tracking
This commit is contained in:
1 parent
33121b3d84
commit
9102104be8
1 file changed
+5
-4
@@ -1599,15 +1599,16 @@ end
|
|||||||
|
|
||||||
function EID:OnUsePill(pillEffectID, player, useFlags)
|
function EID:OnUsePill(pillEffectID, player, useFlags)
|
||||||
player = player or EID.player --AB+ doesn't receive player in callback arguments!
|
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)]
|
local pillColor = EID.PlayerHeldPill[EID:getPlayerID(player)]
|
||||||
if pillColor == 0 then return end -- ignore if no pill found in pocket
|
-- add the pill used to our history for Echo Chamber / Vurp! / transformation progress
|
||||||
EID:AddPickupToHistory("pill", pillEffectID+1, player, useFlags, pillColor) -- Echo Chamber tracking
|
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
|
-- 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)
|
-- (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
|
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
|
EID.UsedPillColors[tostring(pillColor)] = true
|
||||||
|
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill)
|
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user