diff --git a/eid_api.lua b/eid_api.lua index e7691001..b271b96d 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -323,13 +323,13 @@ function EID:getDescriptionObj(Type, Variant, SubType, entity) description.ModName = tableEntry and tableEntry[4] - for _,modifier in pairs(EID.DescModifiers) do + for _,modifier in ipairs(EID.DescModifiers) do local result = modifier.condition(description) if type(result) == "table" then for _,callback in ipairs(result) do - description = callback(description) -- If the modifier loads a different description obj (which also goes through the modifier checks), we should stop our checks so text doesn't get printed twice if description.ObjSubType ~= SubType then break end + description = callback(description) end elseif result then description = modifier.callback(description) @@ -666,6 +666,10 @@ function EID:renderIcon(spriteObj, posX, posY, callback) end spriteObj:Render(Vector(posX, posY), nullVector, nullVector) + + if EID.CachingDescription then + table.insert(EID.CachedIcons, {spriteObj, posX, posY, callback, spriteObj:GetAnimation(), spriteObj:GetFrame()}) + end end -- Returns the icon used for the bulletpoint. It will look at the first word in the given string. @@ -834,6 +838,9 @@ function EID:renderString(str, position, scale, kcolor) local strFiltered, spriteTable = EID:filterIconMarkup(textPart[1], position.X, position.Y) EID:renderInlineIcons(spriteTable, position.X + offsetX, position.Y) EID.font:DrawStringScaledUTF8(strFiltered, position.X + offsetX, position.Y, scale.X, scale.Y, textPart[2], 0, false) + if EID.CachingDescription then + table.insert(EID.CachedStrings, {strFiltered, position.X + offsetX, position.Y, textPart[2]}) + end offsetX = offsetX + EID:getStrWidth(strFiltered) * scale.X end return textPartsTable[#textPartsTable][2] @@ -842,16 +849,22 @@ end -- Adds Description object modifiers. -- Used for altering descriptions. Example: Spindown dice, Tarot Cloth, ... function EID:addDescriptionModifier(modifierName, condition, callback) - EID.DescModifiers[modifierName] = { + table.insert(EID.DescModifiers, { + name = modifierName, condition = condition, callback = callback - } + }) end -- Removes a Description object modifier -- Used for altering descriptions. Example: Spindown dice, Tarot Cloth, ... function EID:removeDescriptionModifier(modifierName) - EID.DescModifiers[modifierName] = nil + for i,v in ipairs(EID.DescModifiers) do + if v[name] == modifierName then + table.remove(EID.DescModifiers,i) + return + end + end end -- Interpolates between 2 KColors with a given fraction. diff --git a/eid_bagofcrafting.lua b/eid_bagofcrafting.lua index 3b264229..805ccbaf 100644 --- a/eid_bagofcrafting.lua +++ b/eid_bagofcrafting.lua @@ -688,9 +688,8 @@ local resetBagCounter = 0 local craftingIsHidden = false local showCraftingResult = false -local prevSimplifiedDesc = "" -local prevListDesc = "" -local refreshTextbox = false +local prevDesc = "" +EID.RefreshBagTextbox = false --this combination algorithm was adopted from this Java code: https://stackoverflow.com/a/16256122 --note that it will run into duplicates, for example if you have eight pennies and a key, it can't tell the difference between @@ -881,7 +880,7 @@ local function RecipeCrunchCoroutine() bagOfCraftingRefreshes = 0 end isRefresh = false - refreshTextbox = true + EID.RefreshBagTextbox = true end function EID:handleBagOfCraftingRendering() @@ -973,7 +972,7 @@ function EID:handleBagOfCraftingRendering() EID.bagOfCraftingCurPickupCount = #pickups calcHeldItems() calcFloorItems() - refreshTextbox = true + EID.RefreshBagTextbox = true else roomItems = EID.bagOfCraftingRoomQueries[curRoomIndex..""] or {} end @@ -1014,18 +1013,17 @@ function EID:handleBagOfCraftingRendering() EID:printDescription(customDescObj) return true elseif EID.Config["BagOfCraftingDisplayMode"] == "No Recipes" then - prevListDesc = "" - if not refreshTextbox and prevSimplifiedDesc ~= "" then - EID:appendToDescription(customDescObj, prevSimplifiedDesc) + if not EID.RefreshBagTextbox and prevDesc ~= "" and not EID.OptionChanged then + EID:appendToDescription(customDescObj, prevDesc) EID:printDescription(customDescObj) return true end - prevSimplifiedDesc = "" - refreshTextbox = false + prevDesc = "" + EID.RefreshBagTextbox = false - prevSimplifiedDesc = prevSimplifiedDesc .. getHotkeyString() - prevSimplifiedDesc = prevSimplifiedDesc .. getFloorItemsString(false, roomItems) + prevDesc = prevDesc .. getHotkeyString() + prevDesc = prevDesc .. getFloorItemsString(false, roomItems) local mostValuableBag = {} for i=1,8 do @@ -1036,10 +1034,10 @@ function EID:handleBagOfCraftingRendering() local bagQualityDesc = EID:getDescriptionEntry("CraftingBagQuality") local bestQualityDesc = EID:getDescriptionEntry("CraftingBestQuality") - if (#EID.BagItems > 0) then prevSimplifiedDesc = prevSimplifiedDesc .. bagQualityDesc .. " " .. bagQuality .. "#" .. bagResult .. "#" end - if (bestQuality > bagQuality) then prevSimplifiedDesc = prevSimplifiedDesc .. bestQualityDesc .. " " .. bestQuality .. "#{{Blank}} " .. tableToCraftingIconsFunc(self,mostValuableBag, true) .. "#" .. bestResult .. "#" end + if (#EID.BagItems > 0) then prevDesc = prevDesc .. bagQualityDesc .. " " .. bagQuality .. "#" .. bagResult .. "#" end + if (bestQuality > bagQuality) then prevDesc = prevDesc .. bestQualityDesc .. " " .. bestQuality .. "#{{Blank}} " .. tableToCraftingIconsFunc(self,mostValuableBag, true) .. "#" .. bestResult .. "#" end - EID:appendToDescription(customDescObj, prevSimplifiedDesc) + EID:appendToDescription(customDescObj, prevDesc) EID:printDescription(customDescObj) return true end @@ -1101,7 +1099,7 @@ function EID:handleBagOfCraftingRendering() upHeld = Isaac.GetTime() --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 - refreshTextbox = true + EID.RefreshBagTextbox = true if (lockedResults == nil) then lockedResults = queryString else lockedResults = nil end --refresh the recipes @@ -1133,20 +1131,19 @@ 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) if (bagOfCraftingOffset >= numResults) then bagOfCraftingOffset = bagOfCraftingOffset - EID.Config["BagOfCraftingResults"] end - prevSimplifiedDesc = "" - if not refreshTextbox and prevListDesc ~= "" and bagOfCraftingOffset == prevOffset then - EID:appendToDescription(customDescObj, prevListDesc) + if not EID.RefreshBagTextbox and prevDesc ~= "" and bagOfCraftingOffset == prevOffset and not EID.OptionChanged then + EID:appendToDescription(customDescObj, prevDesc) EID:printDescription(customDescObj) return true end - prevListDesc = "" - refreshTextbox = false + prevDesc = "" + EID.RefreshBagTextbox = false - prevListDesc = prevListDesc .. getHotkeyString() - prevListDesc = prevListDesc .. getFloorItemsString(true, roomItems) + prevDesc = prevDesc .. getHotkeyString() + prevDesc = prevDesc .. getFloorItemsString(true, roomItems) local resultDesc = EID:getDescriptionEntry("CraftingResults") - prevListDesc = prevListDesc .. resultDesc + prevDesc = prevDesc .. resultDesc local prevItem = 0 @@ -1158,7 +1155,7 @@ function EID:handleBagOfCraftingRendering() --currentRecipesList is now a table of tables for each item, so we have to iterate over the table using sortedIDs if (bagOfCraftingOffset > 0) then - prevListDesc = prevListDesc .. prefix .. "...+"..bagOfCraftingOffset.." more" + prevDesc = prevDesc .. prefix .. "...+"..bagOfCraftingOffset.." more" end local curOffset = 0 refreshPosition = -1 @@ -1172,35 +1169,35 @@ function EID:handleBagOfCraftingRendering() if not v then break end if (curOffset > bagOfCraftingOffset) then if not EID.Config["BagOfCraftingDisplayNames"] then - prevListDesc = prevListDesc .."#{{Collectible"..v[2].."}} " + prevDesc = prevDesc .."#{{Collectible"..v[2].."}} " --tack on the secondary recipe image to achievement-locked recipes - if v[3] then prevListDesc = prevListDesc .."({{Collectible" .. v[3] .. "}})" end + if v[3] then prevDesc = prevDesc .."({{Collectible" .. v[3] .. "}})" end --color the equals sign with the item quality, so the order of the list can make sense - prevListDesc = prevListDesc .. qualities[CraftingItemQualities[v[2]]] .. "={{CR}}" + prevDesc = prevDesc .. qualities[CraftingItemQualities[v[2]]] .. "={{CR}}" --only display the item name if it's the first occurrence else if prevItem ~= v[2] then --substring the first 18 characters of the item name so it fits on one line; is there a way to get around desc line length limits? - prevListDesc = prevListDesc .."#{{Collectible"..v[2].."}} ".. qualities[CraftingItemQualities[v[2]]] .. + prevDesc = prevDesc .."#{{Collectible"..v[2].."}} ".. qualities[CraftingItemQualities[v[2]]] .. string.sub(EID:getObjectName(5, 100, v[2]),1,18).."#" else - prevListDesc = prevListDesc .."#" + prevDesc = prevDesc .."#" end --replace recipe bulletpoint with the secondary recipe on achievement-locked recipes - if v[3] then prevListDesc = prevListDesc .."{{Collectible" .. v[3] .. "}} " end + if v[3] then prevDesc = prevDesc .."{{Collectible" .. v[3] .. "}} " end end - prevListDesc = prevListDesc .. tableToCraftingIconsFunc(self, v[1], true) + prevDesc = prevDesc .. tableToCraftingIconsFunc(self, v[1], true) prevItem = v[2] end end end end if (bagOfCraftingOffset + EID.Config["BagOfCraftingResults"] < numResults) then - prevListDesc = prevListDesc .. prefix .. "...+"..(numResults-EID.Config["BagOfCraftingResults"]-bagOfCraftingOffset).." more" + prevDesc = prevDesc .. prefix .. "...+"..(numResults-EID.Config["BagOfCraftingResults"]-bagOfCraftingOffset).." more" end - EID:appendToDescription(customDescObj, prevListDesc) + EID:appendToDescription(customDescObj, prevDesc) EID:printDescription(customDescObj) return true end diff --git a/eid_modifiers.lua b/eid_modifiers.lua index b10c17e7..40a192c3 100644 --- a/eid_modifiers.lua +++ b/eid_modifiers.lua @@ -101,7 +101,7 @@ local function VoidCallback(descObj, isRune) if REPENTANCE then voidNames[2] = EID:getDescriptionEntry("GlitchedItemText", 1) end local eidTable = (isRune and EID.BlackRuneStatIncreases) or EID.VoidStatIncreases - local increases = ((inPreview or isAltOption) and eidTable[3]) or (shopItem and eidTable[2]) or eidTable[1] + local increases = ((isAltOption or not descObj.Entity) and eidTable[3]) or (shopItem and eidTable[2]) or eidTable[1] EID:appendToDescription(descObj, "#" .. prefix .. voidIntro .. "#") for i,v in ipairs(increases) do @@ -418,8 +418,6 @@ if REPENTANCE then if collectiblesOwned[711] and EID:getEntityData(descObj.Entity, "EID_FlipItemID") then table.insert(callbacks, FlipCallback) end if collectiblesOwned[723] or (EID.absorbedItems[723] and collectiblesOwned[477]) then table.insert(callbacks, SpindownDiceCallback) end - -- currently, only Repentance collectible modifiers have Tab previews so put it here - if EID.player and Input.IsActionPressed(ButtonAction.ACTION_MAP, EID.player.ControllerIndex) and not inPreview then table.insert(callbacks, TabCallback) end -- Card / Rune Callbacks elseif descObj.ObjVariant == PickupVariant.PICKUP_TAROTCARD then @@ -465,3 +463,10 @@ local function EIDConditionsAB(descObj) return callbacks end EID:addDescriptionModifier("EID Afterbirth+", EIDConditionsAB, nil) + +local function TabConditions(descObj) + if EID.player and Input.IsActionPressed(ButtonAction.ACTION_MAP, EID.player.ControllerIndex) and not inPreview then return true end + return false +end + +EID:addDescriptionModifier("EID Tab Previews", TabConditions, TabCallback) diff --git a/main.lua b/main.lua index fdbcb4d8..7e1c35d2 100644 --- a/main.lua +++ b/main.lua @@ -389,6 +389,7 @@ local function handleScaleKey() -- press and hold ScaleKey if Input.IsButtonPressed(ScaleKey, 0) then if scaleHoldFrame > 60 then + EID.MCM_OptionChanged = true local scaleConfigName = (EID.Config["DisplayMode"] == "local" and "LocalScale" or "Scale") if scaleToBigger then local newScale = EID.Scale + scaleSpeed @@ -415,6 +416,7 @@ local function handleScaleKey() end -- press ScaleKey if Input.IsButtonTriggered(ScaleKey, 0) then + EID.MCM_OptionChanged = true scaleHoldFrame = 0 local scale local scaleConfigName = (EID.Config["DisplayMode"] == "local" and "LocalScale" or "Scale") @@ -441,13 +443,37 @@ end --------------------------------------------------------------------------- ---------------------------Printing Functions------------------------------ -local previousFormattedLines = {} -local previousBulletpoints = {} local previousDesc = "" +local previousRenderPos = Vector.Zero +EID.CachingDescription = false +EID.CachedIcons = {} +EID.CachedStrings = {} function EID:printDescription(desc) - local textScale = Vector(EID.Scale, EID.Scale) local renderPos = EID:getTextPosition() + + EID.CachingDescription = false + if previousDesc == desc.Description and not EID.OptionChanged and not EID.MCM_OptionChanged then + local localModeDiff = renderPos - previousRenderPos + -- Drawing our currently saved description + for _,icon in ipairs(EID.CachedIcons) do + icon[1]:SetFrame(icon[5], icon[6]) + EID:renderIcon(icon[1], icon[2] + localModeDiff.X, icon[3] + localModeDiff.Y, icon[4]) + end + for i,str in ipairs(EID.CachedStrings) do + EID.font:DrawStringScaledUTF8(str[1], str[2] + localModeDiff.X, str[3] + localModeDiff.Y, EID.Scale, EID.Scale, str[4], 0, false) + end + return + else + -- Drawing a new description + EID.CachingDescription = true + EID.CachedIcons = {} + EID.CachedStrings = {} + previousDesc = desc.Description + previousRenderPos = Vector(renderPos.X, renderPos.Y) + end + + local textScale = Vector(EID.Scale, EID.Scale) local offsetX = 0 EID.lineHeight = EID.Config["LineHeight"] if EID.Config["ShowItemIcon"] then @@ -484,9 +510,6 @@ function EID:printDescription(desc) end if EID.Config["ShowItemType"] and (itemType == 3 or itemType == 4) then local offsetY = 2 - if EID.Scale < 1 then - offsetY = -1 - end EID.IconSprite:Play(EID.ItemTypeAnm2Names[itemType]) EID:renderIcon(EID.IconSprite, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale) if itemType == 3 then @@ -502,14 +525,8 @@ function EID:printDescription(desc) EID.InlineIconSprite2:SetFrame("numbers", curItemConfig.MaxCharges) end EID:renderIcon(EID.InlineIconSprite2, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale) - offsetX = offsetX + 8 - elseif itemType == 4 then - -- familiar - offsetX = offsetX + 8 - end - if not EID.Config["ShowItemName"] then - renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale end + offsetX = offsetX + 8 end --Display Itemname if EID.Config["ShowItemName"] then @@ -534,7 +551,7 @@ function EID:printDescription(desc) local quality = tonumber(EID.itemConfig:GetCollectible(tonumber(desc.ObjSubType)).Quality) curName = curName.." - {{Quality"..quality.."}}" end - + -- Display the mod this item is from if desc.ModName then if EID.Config["ModIndicatorDisplay"] == "Both" or EID.Config["ModIndicatorDisplay"] == "Name only" then curName = curName .. " {{"..EID.Config["ModIndicatorTextColor"].."}}" .. EID.ModIndicator[desc.ModName].Name @@ -550,9 +567,9 @@ function EID:printDescription(desc) textScale, EID:getNameColor() ) - - renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale end + + renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale --Display Transformation if not (desc.Transformation == "0" or desc.Transformation == "" or desc.Transformation == nil) then @@ -580,48 +597,32 @@ function EID:printDescription(desc) end end end - if previousDesc ~= desc.Description then - EID:clearDescriptionCache() - previousDesc = desc.Description - end EID:printBulletPoints(desc.Description, renderPos) end -function EID:clearDescriptionCache() - previousFormattedLines = {} - previousBulletpoints = {} -end - function EID:printBulletPoints(description, renderPos) local textboxWidth = tonumber(EID.Config["TextboxWidth"]) local textScale = Vector(EID.Scale, EID.Scale) description = EID:replaceShortMarkupStrings(description) - if #previousFormattedLines == 0 then - for line in string.gmatch(description, "([^#]+)") do - previousBulletpoints[#previousFormattedLines+1] = true - for _,v in ipairs(EID:fitTextToWidth(line, textboxWidth, EID.BreakUtf8CharsLanguage[EID.Config["Language"]])) do - table.insert(previousFormattedLines, v) + for line in string.gmatch(description, "([^#]+)") do + local formatedLines = EID:fitTextToWidth(line, textboxWidth, EID.BreakUtf8CharsLanguage[EID.Config["Language"]]) + local textColor = EID:getTextColor() + for i, lineToPrint in ipairs(formatedLines) do + -- render bulletpoint + if i == 1 then + local bpIcon = EID:handleBulletpointIcon(lineToPrint) + if EID:getIcon(bpIcon) ~= EID.InlineIcons["ERROR"] then + lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "", 1) + textColor = EID:renderString(bpIcon, renderPos + Vector(-3 * EID.Scale, 0), textScale , textColor) + else + textColor = EID:renderString(bpIcon, renderPos, textScale , textColor) + end + EID.LastRenderCallColor = EID:copyKColor(textColor) -- Save line start Color for eventual Color Reset call end + textColor = EID:renderString(lineToPrint, renderPos + Vector(12 * EID.Scale, 0), textScale, textColor) + renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale end end - - local textColor = EID:getTextColor() - for i, lineToPrint in ipairs(previousFormattedLines) do - -- render bulletpoint - if previousBulletpoints[i] then - textColor = EID:getTextColor() - local bpIcon = EID:handleBulletpointIcon(lineToPrint) - if EID:getIcon(bpIcon) ~= EID.InlineIcons["ERROR"] then - lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "", 1) - textColor = EID:renderString(bpIcon, renderPos + Vector(-3 * EID.Scale, 0), textScale , textColor) - else - textColor = EID:renderString(bpIcon, renderPos, textScale , textColor) - end - EID.LastRenderCallColor = EID:copyKColor(textColor) -- Save line start Color for eventual Color Reset call - end - textColor = EID:renderString(lineToPrint, renderPos + Vector(12 * EID.Scale, 0), textScale, textColor) - renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale - end end --------------------------------------------------------------------------- ----------------------------Handle New Room-------------------------------- @@ -940,10 +941,13 @@ local searchPartitions = EntityPartition.FAMILIAR + EntityPartition.ENEMY + Enti EID.lastDescriptionEntity = nil EID.lastDist = 0 +EID.OptionChanged = false local function onRender(t) -- Increases by 60 per second, ignores pauses EID.GameRenderCount = EID.GameRenderCount + 1 + EID.OptionChanged = EID.MCM_OptionChanged + EID.MCM_OptionChanged = false EID:resumeCoroutines() EID.isDisplaying = false diff --git a/mod_config_menu.lua b/mod_config_menu.lua index 1c182126..b19d86ef 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -23,6 +23,7 @@ local MCMCompat_isDisplayingDummyMCMObj = false local MCMCompat_oldPermanentObj = false EID.MCMLoaded = MCMLoaded local colorNameArray = {} +EID.MCM_OptionChanged = false local function renderDummyDesc(reload) if reload then @@ -135,6 +136,7 @@ function EID:AddBooleanSetting(category, optionName, displayText, params) end, OnChange = params.onChangeFunc or function(currentBool) EID.Config[optionName] = currentBool + EID.MCM_OptionChanged = true end, Info = params.infoText or {} } @@ -168,6 +170,7 @@ function EID:AddHotkeySetting(category, optionName, displayText, infoText, isCon end, OnChange = function(currentNum) EID.Config[optionName] = currentNum or -1 + EID.MCM_OptionChanged = true end, PopupGfx = ModConfigMenu.PopupGfx.WIDE_SMALL, PopupWidth = 280, @@ -228,6 +231,8 @@ if MCMLoaded then return "Language: " .. displayLanguage[AnIndexOf(EID.Languages, EID.Config["Language"])] end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true + EID.RefreshBagTextbox = true -- Crafting isn't open so it won't notice MCM_OptionChanged, but definitely needs to refresh EID.Config["Language"] = EID.Languages[currentNum] local isFixed = EID:fixDefinedFont() if isFixed then @@ -330,6 +335,7 @@ if MCMLoaded then end, OnChange = function(currentNum) EID.Config["LineHeight"] = currentNum + EID.MCM_OptionChanged = true end, Info = {"Default = 11","Line height will automatically change when changing a font/language"} } @@ -351,7 +357,7 @@ if MCMLoaded then end, OnChange = function(currentNum) EID.Config["TextboxWidth"] = currentNum - EID:clearDescriptionCache() + EID.MCM_OptionChanged = true end, Info = {"Default = 130, varies per language","Width of the EID textbox, in pixels"} } @@ -857,6 +863,7 @@ if MCMLoaded then ) -- Display Mode + -- Note: MCM's dummy desc doesn't play well with changing this at the moment! local displayModes = {"default", "local"} local displayModeTips = {"default: text will be displayed in the top-left of the screen.", "local: text will be displayed under the described object."} MCM.AddSetting( @@ -905,6 +912,7 @@ if MCMLoaded then end end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true if EID.Config["DisplayMode"] == "local" then EID.Config["LocalScale"] = textScales[currentNum] else @@ -920,7 +928,7 @@ if MCMLoaded then "ScaleKey", "Toggle Scale (Keyboard)", "Press or hold this key to toggle the scale.", false) - -- Transparency + -- Local Mode Centered or not MCM.AddSetting( "EID", "Visuals", @@ -937,6 +945,7 @@ if MCMLoaded then return "Local mode centered: " .. onOff end, OnChange = function(currentBool) + EID.MCM_OptionChanged = true EID.Config["LocalModeCentered"] = currentBool end } @@ -957,142 +966,23 @@ if MCMLoaded then AnIndexOf(transparencies, EID.Config["Transparency"]) - 1 .. " " .. EID.Config["Transparency"] end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true EID.Config["Transparency"] = transparencies[currentNum + 1] end } ) MCM.AddSpace("EID", "Visuals") - - --------ShowItemName--------- - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["ShowItemName"] - end, - Display = function() - local onOff = "False" - if EID.Config["ShowItemName"] then - onOff = "True" - end - return "Display Item Name: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["ShowItemName"] = currentBool - end - } - ) - --------ShowItemType--------- - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["ShowItemType"] - end, - Display = function() - local onOff = "False" - if EID.Config["ShowItemType"] then - onOff = "True" - end - return "Display Item Type: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["ShowItemType"] = currentBool - end - } - ) - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["ShowItemIcon"] - end, - Display = function() - local onOff = "False" - if EID.Config["ShowItemIcon"] then - onOff = "True" - end - return "Display Item Icon: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["ShowItemIcon"] = currentBool - end - } - ) - - -------TRANSFORMATIONS--------- - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["TransformationText"] - end, - Display = function() - local onOff = "False" - if EID.Config["TransformationText"] then - onOff = "True" - end - return "Display Transformation Name: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["TransformationText"] = currentBool - end - } - ) - -------TRANSFORMATION ICON--------- - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["TransformationIcons"] - end, - Display = function() - local onOff = "False" - if EID.Config["TransformationIcons"] then - onOff = "True" - end - return "Display Transformation Icon: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["TransformationIcons"] = currentBool - end - } - ) - if REPENTANCE then - -------Quality ICON--------- - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["ShowQuality"] - end, - Display = function() - local onOff = "False" - if EID.Config["ShowQuality"] then - onOff = "True" - end - return "Display Quality Info: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["ShowQuality"] = currentBool - end - } - ) - end + -- Simple toggles of what is shown in the title and transformation lines of a description + EID:AddBooleanSetting("Visuals", "ShowItemName", "Display Item Name") + EID:AddBooleanSetting("Visuals", "ShowItemType", "Display Item Type") + EID:AddBooleanSetting("Visuals", "ShowItemIcon", "Display Item Icon") + EID:AddBooleanSetting("Visuals", "TransformationText", "Display Transformation Name") + EID:AddBooleanSetting("Visuals", "TransformationIcons", "Display Transformation Icon") + EID:AddBooleanSetting("Visuals", "ShowQuality", "Display Quality Info", {repOnly = true}) + EID:AddBooleanSetting("Visuals", "ShowObjectID", "Display Object ID") + -------Mod indicator for modded items--------- local modIndicatorDisplays = {"Both","Name only","Icon only", "None"} MCM.AddSetting( @@ -1109,31 +999,12 @@ if MCMLoaded then return "Mod indicator displayed for: " .. EID.Config["ModIndicatorDisplay"] end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true EID.Config["ModIndicatorDisplay"] = modIndicatorDisplays[currentNum] end } ) - -------Object ID--------- - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["ShowObjectID"] - end, - Display = function() - local onOff = "False" - if EID.Config["ShowObjectID"] then - onOff = "True" - end - return "Display Object ID: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["ShowObjectID"] = currentBool - end - } - ) + --------------------------------------------------------------------------- -----------------------------BAG OF CRAFTING------------------------------- @@ -1155,6 +1026,7 @@ if MCMLoaded then return "Show Display: " .. EID.Config["DisplayBagOfCrafting"] end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true EID.Config["DisplayBagOfCrafting"] = bagDisplays[currentNum] end, Info = {"Always = Always show Results, Hold = Show when holding up bag, Never = Never show results"} @@ -1176,6 +1048,7 @@ if MCMLoaded then return "Display Mode: " .. EID.Config["BagOfCraftingDisplayMode"] end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true EID.Config["BagOfCraftingDisplayMode"] = bagDisplayModes[currentNum] end, Info = {"Toggle showing a list of recipes, an item preview when bag is full, what item pool/quality you might get, or only the floor pickups"} @@ -1207,6 +1080,7 @@ if MCMLoaded then AnIndexOf(diceSteps, EID.Config["BagOfCraftingResults"]) - 1 .. " " .. EID.Config["BagOfCraftingResults"] end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true EID.Config["BagOfCraftingResults"] = diceSteps[currentNum + 1] end, Info = {"Page size for the preview of items currently craftable with Bag of Crafting"} @@ -1269,6 +1143,7 @@ if MCMLoaded then return "Show Item Names: " .. onOff end, OnChange = function(currentBool) + EID.MCM_OptionChanged = true EID.Config["BagOfCraftingDisplayNames"] = currentBool end, Info = {"If on, each result takes two lines; lower your displayed results accordingly"} @@ -1394,6 +1269,7 @@ if MCMLoaded then return "Descriptions: " .. string.gsub(EID.Config["TextColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["TextColor"]).."/"..#colorNameArray..")" end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true if currentNum == 0 then currentNum = #colorNameArray end if currentNum > #colorNameArray then currentNum = 1 end EID.Config["TextColor"] = colorNameArray[currentNum] @@ -1417,6 +1293,7 @@ if MCMLoaded then return "Names: " .. string.gsub(EID.Config["ItemNameColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ItemNameColor"]).."/"..#colorNameArray..")" end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true if currentNum == 0 then currentNum = #colorNameArray end if currentNum > #colorNameArray then currentNum = 1 end EID.Config["ItemNameColor"] = colorNameArray[currentNum] @@ -1440,6 +1317,7 @@ if MCMLoaded then return "Transformations: " .. string.gsub(EID.Config["TransformationColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["TransformationColor"]).."/"..#colorNameArray..")" end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true if currentNum == 0 then currentNum = #colorNameArray end if currentNum > #colorNameArray then currentNum = 1 end EID.Config["TransformationColor"] = colorNameArray[currentNum] @@ -1463,6 +1341,7 @@ if MCMLoaded then return "Errors: " .. string.gsub(EID.Config["ErrorColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ErrorColor"]).."/"..#colorNameArray..")" end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true if currentNum == 0 then currentNum = #colorNameArray end if currentNum > #colorNameArray then currentNum = 1 end EID.Config["ErrorColor"] = colorNameArray[currentNum] @@ -1486,6 +1365,7 @@ if MCMLoaded then return "Mod Indicator: " .. string.gsub(EID.Config["ModIndicatorTextColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ModIndicatorTextColor"]).."/"..#colorNameArray..")" end, OnChange = function(currentNum) + EID.MCM_OptionChanged = true if currentNum == 0 then currentNum = #colorNameArray end if currentNum > #colorNameArray then currentNum = 1 end EID.Config["ModIndicatorTextColor"] = colorNameArray[currentNum]