Merge pull request #517 from Buurazu/master
Pill Color tracking, Echo fixes, AB+ save fix
This commit is contained in:
4 files changed
+37
-39
No files matched your search
+10
-15
@@ -717,12 +717,12 @@ function EID:createItemIconObject(str)
|
|||||||
end
|
end
|
||||||
local cardID,numReplace3 = string.gsub(str, "Card", "")
|
local cardID,numReplace3 = string.gsub(str, "Card", "")
|
||||||
if numReplace3 > 0 and cardID ~= "" and tonumber(cardID) ~= nil then
|
if numReplace3 > 0 and cardID ~= "" and tonumber(cardID) ~= nil then
|
||||||
if tonumber(cardID) > maxCardID then return EID.InlineIcons[str] or EID.InlineIcons["Blank"] end
|
if tonumber(cardID) > maxCardID then return EID.InlineIcons[str] or EID.InlineIcons["Card"] end
|
||||||
return {"Cards", tonumber(cardID)-1, 8, 8, 0, 1, EID.CardPillSprite}
|
return {"Cards", tonumber(cardID)-1, 8, 8, 0, 1, EID.CardPillSprite}
|
||||||
end
|
end
|
||||||
local pillID,numReplace4 = string.gsub(str, "Pill", "")
|
local pillID,numReplace4 = string.gsub(str, "Pill", "")
|
||||||
if numReplace4 > 0 and pillID ~= "" and tonumber(pillID) ~= nil then
|
if numReplace4 > 0 and pillID ~= "" and tonumber(pillID) ~= nil then
|
||||||
if tonumber(pillID) > maxPillID then return EID.InlineIcons[str] or EID.InlineIcons["Blank"] end
|
if tonumber(pillID) > maxPillID then return EID.InlineIcons[str] or EID.InlineIcons["Pill"] end
|
||||||
return {"Pills", tonumber(pillID)-1, 9, 8, 0, 1, EID.CardPillSprite}
|
return {"Pills", tonumber(pillID)-1, 9, 8, 0, 1, EID.CardPillSprite}
|
||||||
end
|
end
|
||||||
if item == nil then
|
if item == nil then
|
||||||
@@ -1769,8 +1769,9 @@ function EID:SetPillEffectUnidentifyable(pillEffectID, isUnidentifyable)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Add pickup usage to history of pickups used by the player
|
-- Add pickup usage to history of pickups used by the player
|
||||||
function EID:AddPickupToHistory(pickupType, effectID, player, useFlags)
|
function EID:AddPickupToHistory(pickupType, effectID, player, useFlags, pillColorID)
|
||||||
if REPENTANCE and useFlags & UseFlag.USE_MIMIC == UseFlag.USE_MIMIC then return end -- dont add mimic pills to history
|
-- don't add mimiced or noannouncer cards/pills to history
|
||||||
|
if REPENTANCE and (useFlags & UseFlag.USE_MIMIC == UseFlag.USE_MIMIC or useFlags & UseFlag.USE_NOANNOUNCER == UseFlag.USE_NOANNOUNCER) then return end
|
||||||
local playerID = EID:getPlayerID(player)
|
local playerID = EID:getPlayerID(player)
|
||||||
EID:InitItemInteractionIfAbsent(playerID)
|
EID:InitItemInteractionIfAbsent(playerID)
|
||||||
|
|
||||||
@@ -1780,8 +1781,8 @@ function EID:AddPickupToHistory(pickupType, effectID, player, useFlags)
|
|||||||
historyTable = EID.PlayerItemInteractions[playerID].altPickupHistory or historyTable
|
historyTable = EID.PlayerItemInteractions[playerID].altPickupHistory or historyTable
|
||||||
end
|
end
|
||||||
|
|
||||||
-- pickupType = ["pill","card"], playerTypeID, effectID, hadEchoChamberWhenUsed
|
-- pickupType = ["pill","card"], pillColorID, effectID, hadEchoChamberWhenUsed
|
||||||
table.insert(historyTable, 1, {pickupType, player:GetPlayerType(), effectID, REPENTANCE and player:HasCollectible(700)})
|
table.insert(historyTable, 1, {pickupType, pillColorID, effectID, REPENTANCE and player:HasCollectible(700)})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Render a sprite of an entity
|
-- Render a sprite of an entity
|
||||||
@@ -1809,13 +1810,7 @@ function EID:IsGridEntity(entity)
|
|||||||
return entity.Type == nil
|
return entity.Type == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns true if the given pilleffect id was used at least once by the current player
|
-- returns true if the given pill color was used at least once in this game
|
||||||
function EID:WasPillUsed(pillEffectID, player)
|
function EID:WasPillUsed(pillColor)
|
||||||
local playerID = EID:getPlayerID(player)
|
return EID.UsedPillColors[tostring(pillColor)] ~= nil
|
||||||
local pillsTable = EID.PlayerItemInteractions[playerID].pills
|
|
||||||
-- Dead Tainted Lazarus exception
|
|
||||||
if player:GetPlayerType() == 38 then
|
|
||||||
pillsTable = EID.PlayerItemInteractions[playerID].altPills or pillsTable
|
|
||||||
end
|
|
||||||
return pillsTable[tostring(pillEffectID)] ~= nil
|
|
||||||
end
|
end
|
||||||
+1
-1
@@ -91,7 +91,7 @@ function EID:getHoldMapDescription(player, checkingTwin)
|
|||||||
if pickupHistory[i][4] then -- Echo chamber was owned before this card/pill was used
|
if pickupHistory[i][4] then -- Echo chamber was owned before this card/pill was used
|
||||||
if pickupHistory[i][1] == "pill" then
|
if pickupHistory[i][1] == "pill" then
|
||||||
local name = EID:getPillName(pickupHistory[i][3], false)
|
local name = EID:getPillName(pickupHistory[i][3], false)
|
||||||
pickupNames = pickupNames .. "{{Pill}} " .. name .. "#"
|
pickupNames = pickupNames .. "{{Pill" .. pickupHistory[i][2] .. "}} " .. name .. "#"
|
||||||
else
|
else
|
||||||
local name = EID:getObjectName(5, 300, pickupHistory[i][3])
|
local name = EID:getObjectName(5, 300, pickupHistory[i][3])
|
||||||
pickupNames = pickupNames .. "{{Card" .. pickupHistory[i][3] .. "}} " .. name .. "#"
|
pickupNames = pickupNames .. "{{Card" .. pickupHistory[i][3] .. "}} " .. name .. "#"
|
||||||
|
|||||||
@@ -173,3 +173,10 @@ local function GameEndTMTRAINER()
|
|||||||
Isaac.DebugString("[EID] Game ended; ignore previous glitched items in the log!")
|
Isaac.DebugString("[EID] Game ended; ignore previous glitched items in the log!")
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, GameEndTMTRAINER)
|
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, GameEndTMTRAINER)
|
||||||
|
|
||||||
|
|
||||||
|
-- shh. it's a non-obtrusive april fools joke for the 1% of people with luadebug
|
||||||
|
-- https://www.youtube.com/watch?v=msDuNZyYAIQ
|
||||||
|
if (os.date("%m/%d") == "04/01") then
|
||||||
|
EID.descriptions["en_us"].sacrifice[1][3] = "{{Coin}} 50% chance of winning 1 coin at Sacrifice#75% chance if you're a genetic freak#!!! If you add Kurt Angle to the mix, your chances of winning drastically go down"
|
||||||
|
end
|
||||||
@@ -18,6 +18,7 @@ EID.coopMainPlayers = {} -- The primary Player Entity for each controller being
|
|||||||
EID.coopAllPlayers = {} -- Every Player Entity (includes Esau, T.Forgotten)
|
EID.coopAllPlayers = {} -- Every Player Entity (includes Esau, T.Forgotten)
|
||||||
EID.controllerIndexes = {} -- A table to map each controller index to their player number for coloring indicators
|
EID.controllerIndexes = {} -- A table to map each controller index to their player number for coloring indicators
|
||||||
EID.isMultiplayer = false -- Used to color P1's highlight/outline indicators (single player just uses white)
|
EID.isMultiplayer = false -- Used to color P1's highlight/outline indicators (single player just uses white)
|
||||||
|
EID.BoC = {}
|
||||||
|
|
||||||
-- general variables
|
-- general variables
|
||||||
EID.PositionModifiers = {}
|
EID.PositionModifiers = {}
|
||||||
@@ -37,6 +38,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 +1476,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 +1583,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
|
-- for tracking used pills, ignore gold pills and noannouncer flag pills
|
||||||
pillsTable = EID.PlayerItemInteractions[playerID].altPills or pillsTable
|
-- (not using a bitmask, because Placebo is mimic+noannouncer, and we want to count those)
|
||||||
end
|
if REPENTANCE and (pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD or useFlags == UseFlag.USE_NOANNOUNCER) then return end
|
||||||
local effectID = tostring(pillEffectID+1)
|
EID.UsedPillColors[tostring(pillColor)] = true
|
||||||
if not pillsTable[effectID] then
|
|
||||||
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)
|
||||||
|
|
||||||
@@ -1606,8 +1603,6 @@ function EID:OnUseCard(cardID, player, useFlags)
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_USE_CARD, EID.OnUseCard)
|
EID:AddCallback(ModCallbacks.MC_USE_CARD, EID.OnUseCard)
|
||||||
|
|
||||||
-- only save and load configs when using MCM. Otherwise Config file changes arent valid
|
|
||||||
if EID.MCMLoaded or REPENTANCE then
|
|
||||||
local json = require("json")
|
local json = require("json")
|
||||||
local configIgnoreList = {
|
local configIgnoreList = {
|
||||||
["BagContent"] = true,
|
["BagContent"] = true,
|
||||||
@@ -1617,6 +1612,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 +1644,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 = {}
|
||||||
@@ -1679,7 +1679,8 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Only copy Saved config entries that exist in the save
|
-- Check if eid_config.lua is in its default state (like if an EID update occurred)
|
||||||
|
-- If it is, or MCM is loaded, load the config from savedata instead of eid_config.lua
|
||||||
if savedEIDConfig.Version == EID.Config.Version then
|
if savedEIDConfig.Version == EID.Config.Version then
|
||||||
local isDefaultConfig = true
|
local isDefaultConfig = true
|
||||||
for key, value in pairs(EID.Config) do
|
for key, value in pairs(EID.Config) do
|
||||||
@@ -1698,11 +1699,7 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- DisableAchievementCheck has been renamed, convert the setting to the new one (this can be removed in a few updates)
|
|
||||||
if savedEIDConfig["DisableAchievementCheck"] then
|
|
||||||
EID.Config["DisableStartOfRunWarnings"] = savedEIDConfig["DisableAchievementCheck"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
EID.isHidden = EID.Config["InitiallyHidden"]
|
EID.isHidden = EID.Config["InitiallyHidden"]
|
||||||
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
||||||
EID.Scale = EID.Config["Size"]
|
EID.Scale = EID.Config["Size"]
|
||||||
@@ -1711,7 +1708,6 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, OnGameStart)
|
EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, OnGameStart)
|
||||||
|
|
||||||
--Saving Moddata--
|
--Saving Moddata--
|
||||||
@@ -1735,6 +1731,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()
|
||||||
@@ -1742,7 +1739,6 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_BOOK_OF_REVELATIONS or CollectibleType.COLLECTIBLE_BOOK_REVELATIONS] = nil
|
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_BOOK_OF_REVELATIONS or CollectibleType.COLLECTIBLE_BOOK_REVELATIONS] = nil
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame)
|
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame)
|
||||||
end
|
|
||||||
|
|
||||||
if EID.enableDebug then
|
if EID.enableDebug then
|
||||||
require("eid_debugging")
|
require("eid_debugging")
|
||||||
|
|||||||
Reference in new issue
Block a user