track Pill Colors, not Pill Effects
This commit is contained in:
1 parent
457cf82dfb
commit
ca9fdb3e35
1 file changed
+17
-15
@@ -37,6 +37,7 @@ EID.CollectedItems = {}
|
|||||||
EID.IgnoredEntities = {}
|
EID.IgnoredEntities = {}
|
||||||
EID.CurrentRoomGridEntities = {}
|
EID.CurrentRoomGridEntities = {}
|
||||||
EID.UnidentifyablePillEffects = {} -- List of pilleffects that are always unidentifyable
|
EID.UnidentifyablePillEffects = {} -- List of pilleffects that are always unidentifyable
|
||||||
|
EID.UsedPillColors = {} -- Colors of pills that have been eaten during this game
|
||||||
local pathsChecked = {}
|
local pathsChecked = {}
|
||||||
local altPathItemChecked = {}
|
local altPathItemChecked = {}
|
||||||
local alwaysUseLocalMode = false -- set to true after drawing a non-local mode description this frame
|
local alwaysUseLocalMode = false -- set to true after drawing a non-local mode description this frame
|
||||||
@@ -1474,7 +1475,7 @@ local function onRender(t)
|
|||||||
local identified = pool:IsPillIdentified(pillColor) and not EID.Config["OnlyShowPillWhenUsedAtLeastOnce"]
|
local identified = pool:IsPillIdentified(pillColor) and not EID.Config["OnlyShowPillWhenUsedAtLeastOnce"]
|
||||||
if REPENTANCE and pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD then identified = true end
|
if REPENTANCE and pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD then identified = true end
|
||||||
local pillEffectID = EID:getAdjustedSubtype(closest.Type, closest.Variant, pillColor)
|
local pillEffectID = EID:getAdjustedSubtype(closest.Type, closest.Variant, pillColor)
|
||||||
local wasUsed = EID:WasPillUsed(pillEffectID, player)
|
local wasUsed = EID:WasPillUsed(pillColor)
|
||||||
|
|
||||||
if (identified or wasUsed or EID.Config["ShowUnidentifiedPillDescriptions"]) and not EID.UnidentifyablePillEffects[pillEffectID] then
|
if (identified or wasUsed or EID.Config["ShowUnidentifiedPillDescriptions"]) and not EID.UnidentifyablePillEffects[pillEffectID] then
|
||||||
local descEntry = EID:getDescriptionObj(closest.Type, closest.Variant, pillColor, closest)
|
local descEntry = EID:getDescriptionObj(closest.Type, closest.Variant, pillColor, closest)
|
||||||
@@ -1581,22 +1582,17 @@ if REPENTANCE then
|
|||||||
end
|
end
|
||||||
|
|
||||||
function EID:OnUsePill(pillEffectID, player, useFlags)
|
function EID:OnUsePill(pillEffectID, player, useFlags)
|
||||||
if (REPENTANCE and player:GetPill(0) % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD) then return end
|
|
||||||
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!
|
||||||
local playerID = EID:getPlayerID(player)
|
-- get the pill color by checking the player's pocket (not accurate for Temperance? and such, but useFlags will help us ignore those)
|
||||||
-- Dead Tainted Lazarus exceptions
|
local pillColor = player:GetPill(0)
|
||||||
local pillsTable = EID.PlayerItemInteractions[playerID].pills
|
if pillColor == 0 then return end -- ignore if no pill found in pocket
|
||||||
|
EID:AddPickupToHistory("pill", pillEffectID+1, player, useFlags, pillColor) -- Echo Chamber tracking
|
||||||
if player:GetPlayerType() == 38 then
|
|
||||||
pillsTable = EID.PlayerItemInteractions[playerID].altPills or pillsTable
|
-- for tracking used pills, ignore gold pills and noannouncer flag pills
|
||||||
end
|
-- (not using a bitmask, because Placebo is mimic+noannouncer, and we want to count those)
|
||||||
local effectID = tostring(pillEffectID+1)
|
if REPENTANCE and (pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD or useFlags == UseFlag.USE_NOANNOUNCER) then return end
|
||||||
if not pillsTable[effectID] then
|
EID.UsedPillColors[tostring(pillColor)] = true
|
||||||
pillsTable[effectID] = 0
|
|
||||||
end
|
|
||||||
pillsTable[effectID] = pillsTable[effectID] + 1
|
|
||||||
|
|
||||||
EID:AddPickupToHistory("pill", pillEffectID+1, player, useFlags)
|
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill)
|
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill)
|
||||||
|
|
||||||
@@ -1617,6 +1613,7 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
["AbsorbedItems"] = true,
|
["AbsorbedItems"] = true,
|
||||||
["CollectedItems"] = true,
|
["CollectedItems"] = true,
|
||||||
["PlayerItemInteractions"] = true,
|
["PlayerItemInteractions"] = true,
|
||||||
|
["UsedPillColors"] = true,
|
||||||
}
|
}
|
||||||
--------------------------------
|
--------------------------------
|
||||||
--------Handle Savadata---------
|
--------Handle Savadata---------
|
||||||
@@ -1648,6 +1645,10 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
-- check for the players' starting active items
|
-- check for the players' starting active items
|
||||||
CheckAllActiveItemProgress()
|
CheckAllActiveItemProgress()
|
||||||
end
|
end
|
||||||
|
EID.UsedPillColors = {}
|
||||||
|
if isSave then
|
||||||
|
EID.UsedPillColors = savedEIDConfig["UsedPillColors"] or {}
|
||||||
|
end
|
||||||
|
|
||||||
if REPENTANCE then
|
if REPENTANCE then
|
||||||
EID.BoC.BagItems = {}
|
EID.BoC.BagItems = {}
|
||||||
@@ -1735,6 +1736,7 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
end
|
end
|
||||||
EID.Config["CollectedItems"] = EID.CollectedItems
|
EID.Config["CollectedItems"] = EID.CollectedItems
|
||||||
EID.Config["PlayerItemInteractions"] = EID.PlayerItemInteractions or {}
|
EID.Config["PlayerItemInteractions"] = EID.PlayerItemInteractions or {}
|
||||||
|
EID.Config["UsedPillColors"] = EID.UsedPillColors
|
||||||
|
|
||||||
EID.SaveData(EID, json.encode(EID.Config))
|
EID.SaveData(EID, json.encode(EID.Config))
|
||||||
EID:hidePermanentText()
|
EID:hidePermanentText()
|
||||||
|
|||||||
Reference in new issue
Block a user