ItemReminder: Fixed some bugs regardign NoOverview mode, auto-scroll and auto-trimming
This commit is contained in:
1 parent
0635e3436e
commit
6de9ff5156
3 files changed
+30
-15
No files matched your search
+28
-14
@@ -3,7 +3,7 @@ local GLITCH_ITEM_FLAG = 4294967296
|
|||||||
local currentBlacklist
|
local currentBlacklist
|
||||||
local lastInputTime = 0
|
local lastInputTime = 0
|
||||||
local lastScrollDirection = 1 -- used for automatic scroll feature, if no description is visible for a category
|
local lastScrollDirection = 1 -- used for automatic scroll feature, if no description is visible for a category
|
||||||
local lastAutoScrollPosition = -1 -- Stores last category before the automatic category skip. This prevents infinite loops, when the player has no items
|
local autoScrollTriesLeft = -999 -- Stores how many tries the automatic category skip has left to do. This prevents infinite loops, when the player has no items
|
||||||
local numAvailableDescriptionSlots = 0
|
local numAvailableDescriptionSlots = 0
|
||||||
|
|
||||||
EID.ItemReminderBlacklist = { ["5.100.714"] = true, ["5.100.715"] = true } -- Dont display these in the Item reminder view
|
EID.ItemReminderBlacklist = { ["5.100.714"] = true, ["5.100.715"] = true } -- Dont display these in the Item reminder view
|
||||||
@@ -420,7 +420,7 @@ function EID:ItemReminderHandleInputs()
|
|||||||
if Input.IsActionTriggered(EID.Config["ItemReminderNavigateLeftButton"], EID.holdTabPlayer.ControllerIndex) and Isaac.GetTime() - lastInputTime > 50 then
|
if Input.IsActionTriggered(EID.Config["ItemReminderNavigateLeftButton"], EID.holdTabPlayer.ControllerIndex) and Isaac.GetTime() - lastInputTime > 50 then
|
||||||
EID.ItemReminderSelectedCategory = (EID.ItemReminderSelectedCategory - 1) % #EID.ItemReminderCategories
|
EID.ItemReminderSelectedCategory = (EID.ItemReminderSelectedCategory - 1) % #EID.ItemReminderCategories
|
||||||
if EID.Config["ItemReminderDisplayMode"] == "NoOverview" and EID.ItemReminderSelectedCategory == 0 then
|
if EID.Config["ItemReminderDisplayMode"] == "NoOverview" and EID.ItemReminderSelectedCategory == 0 then
|
||||||
EID.ItemReminderSelectedCategory = #EID.ItemReminderCategories
|
EID.ItemReminderSelectedCategory = #EID.ItemReminderCategories - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
EID.ForceRefreshCache = true
|
EID.ForceRefreshCache = true
|
||||||
@@ -596,22 +596,21 @@ function EID:ItemReminderGetDescription()
|
|||||||
|
|
||||||
-- Skip category if nothing is in it
|
-- Skip category if nothing is in it
|
||||||
if #EID.ItemReminderTempDescriptions == 0 then
|
if #EID.ItemReminderTempDescriptions == 0 then
|
||||||
if lastAutoScrollPosition == -1 then
|
if autoScrollTriesLeft == -999 then
|
||||||
-- auto scroll was started. store last valid category. skip overview if its disabled
|
-- auto scroll was started
|
||||||
if EID.Config["ItemReminderDisplayMode"] == "NoOverview" and EID.ItemReminderSelectedCategory == 0 then
|
autoScrollTriesLeft = #EID.ItemReminderCategories - 1
|
||||||
lastAutoScrollPosition = lastScrollDirection % #EID.ItemReminderCategories
|
|
||||||
else
|
|
||||||
lastAutoScrollPosition = EID.ItemReminderSelectedCategory
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
EID.ItemReminderSelectedCategory = (EID.ItemReminderSelectedCategory + lastScrollDirection) %
|
EID.ItemReminderSelectedCategory = (EID.ItemReminderSelectedCategory + lastScrollDirection) %
|
||||||
#EID.ItemReminderCategories
|
#EID.ItemReminderCategories
|
||||||
if EID.Config["ItemReminderDisplayMode"] == "NoOverview" and EID.ItemReminderSelectedCategory == 0 then
|
if EID.Config["ItemReminderDisplayMode"] == "NoOverview" and EID.ItemReminderSelectedCategory == 0 then
|
||||||
EID.ItemReminderSelectedCategory = #EID.ItemReminderCategories
|
EID.ItemReminderSelectedCategory = (EID.ItemReminderSelectedCategory + lastScrollDirection) %
|
||||||
|
#EID.ItemReminderCategories
|
||||||
|
autoScrollTriesLeft = autoScrollTriesLeft - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if lastAutoScrollPosition ~= EID.ItemReminderSelectedCategory then
|
if autoScrollTriesLeft > 0 then
|
||||||
|
autoScrollTriesLeft = autoScrollTriesLeft - 1
|
||||||
-- new category found. try to display text
|
-- new category found. try to display text
|
||||||
local newCategoryText = EID:ItemReminderGetDescription()
|
local newCategoryText = EID:ItemReminderGetDescription()
|
||||||
if newCategoryText ~= "" then
|
if newCategoryText ~= "" then
|
||||||
@@ -619,11 +618,11 @@ function EID:ItemReminderGetDescription()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- auto scroll was stopped. reset scroll value
|
-- auto scroll was stopped. reset scroll value
|
||||||
lastAutoScrollPosition = -1
|
autoScrollTriesLeft = -999
|
||||||
EID.InsideItemReminder = false
|
EID.InsideItemReminder = false
|
||||||
return "{{Blank}}#{{Blank}} " .. EID:getDescriptionEntry("ItemReminder", "InventoryEmpty")
|
return "{{Blank}}#{{Blank}} " .. EID:getDescriptionEntry("ItemReminder", "InventoryEmpty")
|
||||||
end
|
end
|
||||||
lastAutoScrollPosition = -1
|
autoScrollTriesLeft = -999
|
||||||
|
|
||||||
local finalHoldMapDesc = "{{Blank}}#"
|
local finalHoldMapDesc = "{{Blank}}#"
|
||||||
|
|
||||||
@@ -634,12 +633,27 @@ function EID:ItemReminderGetDescription()
|
|||||||
finalHoldMapDesc = scrollbar
|
finalHoldMapDesc = scrollbar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- roughly estimate space the descriptions would occupy. trim descriptions if nessesary
|
||||||
|
local tryTrim = EID.ItemReminderSelectedCategory == 0
|
||||||
|
if tryTrim then
|
||||||
|
local countText = 0
|
||||||
|
local countLines = 0
|
||||||
|
for _, entry in ipairs(EID.ItemReminderTempDescriptions) do
|
||||||
|
countText = countText + #entry[3]
|
||||||
|
local _, numLinebreaks = entry[3]:gsub("#","")
|
||||||
|
countLines = countLines + numLinebreaks + 2 -- one for the item name, one for initial line
|
||||||
|
end
|
||||||
|
countLines = countLines + math.ceil(countText/EID.Config["TextboxWidth"])
|
||||||
|
if countLines < 12 then
|
||||||
|
tryTrim = false -- dont trim if screen is not filled with a lot of text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Default: put all descriptions into one long description
|
-- Default: put all descriptions into one long description
|
||||||
for _, entry in ipairs(EID.ItemReminderTempDescriptions) do
|
for _, entry in ipairs(EID.ItemReminderTempDescriptions) do
|
||||||
local description = entry[3] .. "#"
|
local description = entry[3] .. "#"
|
||||||
|
|
||||||
if EID.ItemReminderSelectedCategory == 0 then
|
if tryTrim then
|
||||||
description = EID:ItemReminderTrimBulletPoints(description)
|
description = EID:ItemReminderTrimBulletPoints(description)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -584,7 +584,7 @@ if MCMLoaded then
|
|||||||
function(currentNum)
|
function(currentNum)
|
||||||
EID.MCM_OptionChanged = true
|
EID.MCM_OptionChanged = true
|
||||||
EID.ItemReminderSelectedItem = 0
|
EID.ItemReminderSelectedItem = 0
|
||||||
EID.ItemReminderSelectedCategory = 0
|
EID.ItemReminderSelectedCategory = currentNum ~= 2 and 0 or 1 -- reset category
|
||||||
EID.Config["ItemReminderDisplayMode"] = itemReminderModes[currentNum]
|
EID.Config["ItemReminderDisplayMode"] = itemReminderModes[currentNum]
|
||||||
end})
|
end})
|
||||||
EID:AddBooleanSetting("Reminder", "ItemReminderDisableInputs", "Disable Player Inputs", { infoText = "Prevents the player from doing inputs when item reminder is visible"})
|
EID:AddBooleanSetting("Reminder", "ItemReminderDisableInputs", "Disable Player Inputs", { infoText = "Prevents the player from doing inputs when item reminder is visible"})
|
||||||
|
|||||||
@@ -1786,6 +1786,7 @@ function EID:OnGameStart(isSave)
|
|||||||
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"]
|
||||||
|
EID.ItemReminderSelectedCategory = EID.Config["ItemReminderDisplayMode"] == "NoOverview" and 1 or 0
|
||||||
|
|
||||||
EID:fixDefinedFont()
|
EID:fixDefinedFont()
|
||||||
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
||||||
|
|||||||
Reference in new issue
Block a user