Refresh rate option and co-op fixes

This commit is contained in:
Buurazu authored and GitHub committed 2022-03-05 05:14:27 -05:00
1 parent 060e64ebb1
commit 581d3e8cf4
1 file changed
+29 -8
+29 -8
View File
@@ -444,10 +444,12 @@ EID.previousDescs = {}
EID.CachingDescription = false EID.CachingDescription = false
EID.CachedIcons = {} EID.CachedIcons = {}
EID.CachedStrings = {} EID.CachedStrings = {}
EID.CachedIndicators = {}
EID.CachedRenderPoses = {} EID.CachedRenderPoses = {}
EID.descriptionsToPrint = {} EID.descriptionsToPrint = {}
EID.entitiesToPrint = {} EID.entitiesToPrint = {}
function EID:addDescriptionToPrint(desc) function EID:addDescriptionToPrint(desc)
if desc.Entity and EID.entitiesToPrint[GetPtrHash(desc.Entity)] then return end if desc.Entity and EID.entitiesToPrint[GetPtrHash(desc.Entity)] then return end
table.insert(EID.descriptionsToPrint, desc) table.insert(EID.descriptionsToPrint, desc)
@@ -474,8 +476,11 @@ function EID:printDescriptions(useCached)
end end
-- Print our cached descriptions -- Print our cached descriptions
for i,newDesc in ipairs(EID.descriptionsToPrint) do for i,indicator in ipairs(EID.CachedIndicators) do
EID:printDescription(newDesc, i) EID:renderIndicator(indicator[1], indicator[2])
end
for i,oldDesc in ipairs(EID.previousDescs) do
EID:printDescription(oldDesc, i)
end end
end end
@@ -982,7 +987,7 @@ function EID:onGameUpdate()
end end
-- Remove Crane Game item data if it's giving the prize out -- Remove Crane Game item data if it's giving the prize out
if REPENTANCE and EID.GameUpdateCount % 15 == 0 then if REPENTANCE and EID.GameUpdateCount % 10 == 0 then
for _, crane in ipairs(Isaac.FindByType(6, 16, -1, true, false)) do for _, crane in ipairs(Isaac.FindByType(6, 16, -1, true, false)) do
if EID.CraneItemType[tostring(crane.InitSeed)] then if EID.CraneItemType[tostring(crane.InitSeed)] then
if crane:GetSprite():IsPlaying("Prize") then if crane:GetSprite():IsPlaying("Prize") then
@@ -1129,6 +1134,13 @@ local function onRender(t)
EID.MCM_OptionChanged = false EID.MCM_OptionChanged = false
EID:resumeCoroutines() EID:resumeCoroutines()
ArrowSprite:Update() ArrowSprite:Update()
if REPENTANCE then
local hasBag, bagPlayer = EID:PlayersHaveCollectible(710)
if hasBag then
EID.bagPlayer = bagPlayer
EID:handleBagOfCraftingUpdating()
end
end
EID.isDisplaying = false EID.isDisplaying = false
EID:setPlayer() EID:setPlayer()
@@ -1170,6 +1182,14 @@ local function onRender(t)
return return
end end
-- This is not a frame we should check for new descriptions; just print our cached ones
if not EID:RefreshThisFrame() then
EID:printDescriptions(true)
return
end
EID.CachedIndicators = {}
if EID.Config["EnableMouseControls"] then if EID.Config["EnableMouseControls"] then
local hudDescription = EID:handleHoverHUD() local hudDescription = EID:handleHoverHUD()
if hudDescription then if hudDescription then
@@ -1194,7 +1214,6 @@ local function onRender(t)
-- Check if this player has the Bag of Crafting -- Check if this player has the Bag of Crafting
local craftingSuccess = false local craftingSuccess = false
if REPENTANCE and player:HasCollectible(710) then if REPENTANCE and player:HasCollectible(710) then
EID.bagPlayer = player
craftingSuccess = EID:handleBagOfCraftingRendering() craftingSuccess = EID:handleBagOfCraftingRendering()
if craftingSuccess then if craftingSuccess then
displayedDesc = true displayedDesc = true
@@ -1202,8 +1221,11 @@ local function onRender(t)
end end
-- If we're in the Crafting options tab, the only rendering we want to happen is the Bag of Crafting preview -- If we're in the Crafting options tab, the only rendering we want to happen is the Bag of Crafting preview
if EID.MCMCompat_isDisplayingEIDTab == "Crafting" then if EID.MCMCompat_isDisplayingEIDTab == "Crafting" then
if craftingSuccess then EID:printDescription(descsToDisplay[#descsToDisplay]) end if craftingSuccess then
return EID:printDescription(EID.descriptionsToPrint[#EID.descriptionsToPrint])
return
end
if i == #playerSearch then return end
end end
if not displayedDesc or EID.Config["DisplayAllNearby"] then if not displayedDesc or EID.Config["DisplayAllNearby"] then
@@ -1243,11 +1265,10 @@ local function onRender(t)
-- we only want to describe the closest entity -- we only want to describe the closest entity
inRangeEntities = { EID.lastDescriptionEntity } inRangeEntities = { EID.lastDescriptionEntity }
end end
--inRangeEntities = { EID.lastDescriptionEntity }
table.insert(inRangeEntities, 1, EID.lastDescriptionEntity)
-- Only display the indicator for the primary (closest / crafting) description -- Only display the indicator for the primary (closest / crafting) description
if EID.lastDescriptionEntity and not displayedCrafting then if EID.lastDescriptionEntity and not displayedCrafting then
EID:renderIndicator(EID.lastDescriptionEntity, EID.controllerIndexes[player.ControllerIndex]) EID:renderIndicator(EID.lastDescriptionEntity, EID.controllerIndexes[player.ControllerIndex])
table.insert(EID.CachedIndicators, {EID.lastDescriptionEntity, EID.controllerIndexes[player.ControllerIndex]})
end end
for _,closest in ipairs(inRangeEntities) do for _,closest in ipairs(inRangeEntities) do