Cache even more, refresh after hotkeys

This commit is contained in:
Buurazu authored and GitHub committed 2022-01-29 05:00:13 -05:00
1 parent 711f348706
commit b664bda3ca
1 file changed
+8 -9
+8 -9
View File
@@ -1014,20 +1014,19 @@ function EID:handleBagOfCraftingRendering()
EID:printDescription(customDescObj) EID:printDescription(customDescObj)
return true return true
elseif EID.Config["BagOfCraftingDisplayMode"] == "No Recipes" then elseif EID.Config["BagOfCraftingDisplayMode"] == "No Recipes" then
EID:appendToDescription(customDescObj, getHotkeyString())
EID:appendToDescription(customDescObj, getFloorItemsString(false, roomItems))
prevListDesc = "" prevListDesc = ""
if not refreshTextbox and prevSimplifiedDesc ~= "" then if not refreshTextbox and prevSimplifiedDesc ~= "" then
EID:appendToDescription(customDescObj, prevSimplifiedDesc) EID:appendToDescription(customDescObj, prevSimplifiedDesc)
EID:printDescription(customDescObj) EID:printDescription(customDescObj)
return true return true
end end
-- The floor item text can change without our total item query string changing, so only cache what comes after that
prevSimplifiedDesc = "" prevSimplifiedDesc = ""
refreshTextbox = false refreshTextbox = false
prevSimplifiedDesc = prevSimplifiedDesc .. getHotkeyString()
prevSimplifiedDesc = prevSimplifiedDesc .. getFloorItemsString(false, roomItems)
local mostValuableBag = {} local mostValuableBag = {}
for i=1,8 do for i=1,8 do
mostValuableBag[i] = itemQuery[i] mostValuableBag[i] = itemQuery[i]
@@ -1102,6 +1101,7 @@ function EID:handleBagOfCraftingRendering()
upHeld = Isaac.GetTime() upHeld = Isaac.GetTime()
--lock the current results so you can actually do a recipe that you've scrolled down to without losing it --lock the current results so you can actually do a recipe that you've scrolled down to without losing it
elseif Input.IsActionTriggered(ButtonAction.ACTION_SHOOTLEFT, EID.player.ControllerIndex) then elseif Input.IsActionTriggered(ButtonAction.ACTION_SHOOTLEFT, EID.player.ControllerIndex) then
refreshTextbox = true
if (lockedResults == nil) then lockedResults = queryString if (lockedResults == nil) then lockedResults = queryString
else lockedResults = nil end else lockedResults = nil end
--refresh the recipes --refresh the recipes
@@ -1123,6 +1123,7 @@ function EID:handleBagOfCraftingRendering()
resetBagCounter = resetBagCounter + 1 resetBagCounter = resetBagCounter + 1
if resetBagCounter > 120 then if resetBagCounter > 120 then
EID.BagItems = {} EID.BagItems = {}
recheckPickups = true
resetBagCounter = 0 resetBagCounter = 0
end end
else else
@@ -1132,9 +1133,6 @@ function EID:handleBagOfCraftingRendering()
--fix bug with being allowed to go to an empty page if recipe count = multiple of page size (or if we refresh on last page) --fix bug with being allowed to go to an empty page if recipe count = multiple of page size (or if we refresh on last page)
if (bagOfCraftingOffset >= numResults) then bagOfCraftingOffset = bagOfCraftingOffset - EID.Config["BagOfCraftingResults"] end if (bagOfCraftingOffset >= numResults) then bagOfCraftingOffset = bagOfCraftingOffset - EID.Config["BagOfCraftingResults"] end
EID:appendToDescription(customDescObj, getHotkeyString())
EID:appendToDescription(customDescObj, getFloorItemsString(true, roomItems))
prevSimplifiedDesc = "" prevSimplifiedDesc = ""
if not refreshTextbox and prevListDesc ~= "" and bagOfCraftingOffset == prevOffset then if not refreshTextbox and prevListDesc ~= "" and bagOfCraftingOffset == prevOffset then
EID:appendToDescription(customDescObj, prevListDesc) EID:appendToDescription(customDescObj, prevListDesc)
@@ -1142,10 +1140,11 @@ function EID:handleBagOfCraftingRendering()
return true return true
end end
-- The floor item text can change without our total item query string changing, so only cache what comes after that
prevListDesc = "" prevListDesc = ""
refreshTextbox = false refreshTextbox = false
prevListDesc = prevListDesc .. getHotkeyString()
prevListDesc = prevListDesc .. getFloorItemsString(true, roomItems)
local resultDesc = EID:getDescriptionEntry("CraftingResults") local resultDesc = EID:getDescriptionEntry("CraftingResults")
prevListDesc = prevListDesc .. resultDesc prevListDesc = prevListDesc .. resultDesc