From ad0df0d0a17d138f9bc7694e8dd42c0781a99d31 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 04:33:34 -0500 Subject: [PATCH 01/21] Rename the start of run warnings --- eid_config.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eid_config.lua b/eid_config.lua index 1da7fe72..771099c3 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -75,10 +75,10 @@ EID.UserConfig = { -- Toggle obstruction based hiding, when the player has flight -- Default = true ["DisableObstructionOnFlight"] = true, - -- If set to true, the mod will no longer display a warning if the save game doesn't have achievements unlocked - -- This also disables warnings for using an outdated game version and for having potentially modded Bag of Crafting recipes + -- If set to true, the mod will no longer display critical warnings during the start of a new game + -- Current warnings are: Achievements are locked, outdated game version, and potentially having inaccurate modded Bag of Crafting recipes -- Default = false - ["DisableAchievementCheck"] = false, + ["DisableStartOfRunWarnings"] = false, ---------- Display Modes ----------- @@ -390,7 +390,7 @@ EID.DefaultConfig = { ["InitiallyHidden"] = false, ["HideInBattle"] = false, ["DisableObstructionOnFlight"] = true, - ["DisableAchievementCheck"] = false, + ["DisableStartOfRunWarnings"] = false, ["DisableOnCurse"] = true, ["DisableOnAltPath"] = true, ["DisableOnAprilFoolsChallenge"] = true, From 44a8788f6e63cbc5729f7c6e86b614461bfb1d64 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 04:34:30 -0500 Subject: [PATCH 02/21] add english-specific desc entry grabber --- eid_api.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eid_api.lua b/eid_api.lua index 7aab22d9..5e8d8601 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -199,7 +199,8 @@ function EID:addColor(shortcut, kColor, callback) end -- Overrides all potentially displayed texts and permanently displays the given texts. Can be turned of again using the "EID:hidePermanentText()" function -function EID:displayPermanentText(descriptionObject) +function EID:displayPermanentText(descriptionObject, permName1, permName2) + descriptionObject.PermanentTextEnglish = EID:getDescriptionEntryEnglish(permName1, permName2) EID.permanentDisplayTextObj = descriptionObject EID.isDisplayingPermanent = true end @@ -367,6 +368,13 @@ function EID:getDescriptionEntry(objTable, objID, noFallback) else return (translatedTable and translatedTable[objID]) or (EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objID]) end end end +function EID:getDescriptionEntryEnglish(objTable, objID) + if not objID then + return EID.descriptions["en_us"][objTable] + else + return EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objID] + end +end -- returns the description data table related to a given id, variant and subtype -- falls back to english if it doesnt exist @@ -915,7 +923,7 @@ function EID:CheckGlitchedItemConfig(id) local localizedNames = EID:getDescriptionEntry("GlitchedItemText") local item = EID.itemConfig:GetCollectible(id) if not item then return "" end - local attributes = "" + local attributes = "#" for _,v in ipairs(itemConfigItemAttributes) do local val = item[v] if val ~= 0 then From b28aa3897e56d87892e752491b434da92f122a4f Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 04:36:28 -0500 Subject: [PATCH 03/21] fix Scale hotkey/mode issues, don't check glitched config every frame, rename achievement check --- main.lua | 153 +++++++++++++++++++++++++------------------------------ 1 file changed, 70 insertions(+), 83 deletions(-) diff --git a/main.lua b/main.lua index 541e53a6..1c4c565a 100644 --- a/main.lua +++ b/main.lua @@ -384,61 +384,52 @@ local scaleMin = 0.1 local scaleMax = 2 local scaleSpeed = 0.01 -- scale size per frame local scaleToBigger = true +local scaleConfigName = "Size" local scaleHoldFrame = 0 local function handleScaleKey() - local scaleKey = EID.Config["SizeHotkey"] - - -- 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 "LocalModeSize" or "Size") - if scaleToBigger then - local newScale = EID.Scale + scaleSpeed + if not ModConfigMenu or not ModConfigMenu.IsVisible then + local scaleKey = EID.Config["SizeHotkey"] + -- press and hold ScaleKey + if Input.IsButtonPressed(scaleKey, 0) then + if scaleHoldFrame > 60 then + EID.MCM_OptionChanged = true + local newScale + if scaleToBigger then + newScale = EID.Scale + scaleSpeed + if newScale > scaleMax then + scaleToBigger = false + end + else + newScale = EID.Scale - scaleSpeed + if newScale < scaleMin then + scaleToBigger = true + end + end EID.Scale = newScale EID.Config[scaleConfigName] = newScale - - if newScale > scaleMax then - scaleToBigger = false - end else - local newScale = EID.Scale - scaleSpeed - - EID.Scale = newScale - EID.Config[scaleConfigName] = newScale - - if newScale < scaleMin then - scaleToBigger = true - end + scaleHoldFrame = scaleHoldFrame + 1 end - else - scaleHoldFrame = scaleHoldFrame + 1 end - end - -- press ScaleKey - if Input.IsButtonTriggered(scaleKey, 0) then - EID.MCM_OptionChanged = true - scaleHoldFrame = 0 - local scale - local scaleConfigName = (EID.Config["DisplayMode"] == "local" and "LocalModeSize" or "Size") + -- press ScaleKey + if Input.IsButtonTriggered(scaleKey, 0) then + EID.MCM_OptionChanged = true + scaleHoldFrame = 0 + local scale = EID.Scale - scale = EID.Scale + -- switch between 1, 1.5 and 0.5 + if math.abs(scale - 1) < 0.01 then + scale = 1.5 + elseif math.abs(scale - 1.5) < 0.01 then + scale = 0.5 + else + scale = 1 + end - -- switch between 1, 1.5 and 0.5 - - if math.abs(scale - 1) < 0.01 then - scale = 1.5 - elseif math.abs(scale - 1.5) < 0.01 then - scale = 0.5 - elseif math.abs(scale - 0.5) < 0.01 then - scale = 1 - else - scale = 1 + EID.Config[scaleConfigName] = scale + EID.Scale = scale end - - EID.Config[scaleConfigName] = scale - EID.Scale = scale end end @@ -551,11 +542,11 @@ function EID:printDescription(desc) local curLanguage = EID.Config["Language"] if curLanguage ~= "en_us" then EID.Config["Language"] = "en_us" - local englishName = EID:getObjectName(desc.ObjType, desc.ObjVariant, desc.ObjSubType) + local englishName = desc.PermanentTextEnglish or EID:getObjectName(desc.ObjType, desc.ObjVariant, desc.ObjSubType) EID.Config["Language"] = curLanguage if EID.Config["TranslateItemName"] == 1 then curName = englishName - elseif EID.Config["TranslateItemName"] == 3 and curName ~= englishName and not EID.isDisplayingPermanent then + elseif EID.Config["TranslateItemName"] == 3 and curName ~= englishName then curName = curName.." ("..englishName..")" end end @@ -738,40 +729,31 @@ function EID:renderIndicator(entity) sprite.Color = Color(1, 1, 1, 1, 0, 0, 0) EID:renderEntity(entity, sprite, entityPos) end - if REPENTANCE then - if isMirrorRoom then - sprite.FlipX = false - end - end -end - -function EID:ScaleValue(entity) - if entity.Variant == EffectVariant.DICE_FLOOR then - EID.Scale = EID.Config["Size"] - EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) - elseif EID.Config["DisplayMode"] == "local" then - EID.Scale = EID.Config["LocalModeSize"] + if isMirrorRoom then + sprite.FlipX = false end end function EID:PositionLocalMode(entity) - if EID.Config["DisplayMode"] == "local" then + -- don't use Local Mode for descriptions without an entity (or dice floors) + if EID.Config["DisplayMode"] == "local" and entity and entity.Variant ~= EffectVariant.DICE_FLOOR then + EID.Scale = EID.Config["LocalModeSize"] + scaleConfigName = "LocalModeSize" local textBoxWidth = EID.Config["LocalModeCentered"] and tonumber(EID.Config["TextboxWidth"])/2 * EID.Scale or -30 local textPosOffset = Vector(-textBoxWidth, 20) EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset)) - if REPENTANCE then - if isMirrorRoom then - EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset * Vector(-1,0))) - local screenCenter = EID:getScreenSize()/2 - EID.UsedPosition.X = EID.UsedPosition.X - (EID.UsedPosition-screenCenter).X * 2 - end + if isMirrorRoom then + EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset * Vector(-1,0))) + local screenCenter = EID:getScreenSize()/2 + EID.UsedPosition.X = EID.UsedPosition.X - (EID.UsedPosition-screenCenter).X * 2 end if entity:ToPickup() and entity:ToPickup():IsShopItem() then EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset)) end else - EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) EID.Scale = EID.Config["Size"] + scaleConfigName = "Size" + EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) end end @@ -913,19 +895,21 @@ local function renderAchievementInfo() local demoDescObj = EID:getDescriptionObj(-999, -1, 1) demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" demoDescObj.Description = EID:getDescriptionEntry("OldGameVersionWarningText") or "" - EID:displayPermanentText(demoDescObj) + EID:displayPermanentText(demoDescObj, "AchievementWarningTitle") hasShownAchievementWarning = true -- Bag of Crafting modded items check - elseif EID.player:HasCollectible(710) and EID:DetectModdedItems() and EID.Config.DisplayBagOfCrafting ~= "never" and (EID.Config.BagOfCraftingDisplayMode == "Recipe List" or EID.Config.BagOfCraftingDisplayMode == "Preview Only") then + elseif EID.player:HasCollectible(710) and EID:DetectModdedItems() and EID.Config.DisplayBagOfCrafting ~= "never" and + (EID.Config.BagOfCraftingDisplayMode == "Recipe List" or EID.Config.BagOfCraftingDisplayMode == "Preview Only") then local demoDescObj = EID:getDescriptionObj(-999, -1, 1) demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" demoDescObj.Description = EID:getDescriptionEntry("ModdedRecipesWarningText") or "" - EID:displayPermanentText(demoDescObj) + EID:displayPermanentText(demoDescObj, "AchievementWarningTitle") hasShownAchievementWarning = true -- Achievements Locked Check (do we have Cube of Meat or Book of Revelations unlocked?) else local characterID = EID.player:GetPlayerType() - --ID 21 = Tainted Isaac. Tainted characters have definitely beaten Mom! (Fixes Tainted Lost's item pools ruining this check) + -- ID 21 = Tainted Isaac. Tainted characters have definitely beaten Mom! + -- (Fixes Tainted Lost's item pools, and potentially modded character's mechanics, ruining this check) if characterID < 21 and game.Challenge == 0 and not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) then local hasBookOfRevelationsUnlocked = EID:isCollectibleUnlockedAnyPool(CollectibleType.COLLECTIBLE_BOOK_OF_REVELATIONS or CollectibleType.COLLECTIBLE_BOOK_REVELATIONS) if not hasBookOfRevelationsUnlocked then @@ -934,7 +918,7 @@ local function renderAchievementInfo() local demoDescObj = EID:getDescriptionObj(-999, -1, 1) demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" demoDescObj.Description = EID:getDescriptionEntry("AchievementWarningText") or "" - EID:displayPermanentText(demoDescObj) + EID:displayPermanentText(demoDescObj, "AchievementWarningTitle") hasShownAchievementWarning = true end end @@ -960,16 +944,16 @@ local function onRender(t) EID.OptionChanged = EID.MCM_OptionChanged EID.MCM_OptionChanged = false EID:resumeCoroutines() + handleScaleKey() EID.isDisplaying = false EID:setPlayer() + EID:PositionLocalMode() -- default to non-local mode to fix MCM / Bag errors EID.TabPreviewID = 0 if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then EID.isHidden = not EID.isHidden end - - handleScaleKey() if ModConfigMenu and ModConfigMenu.IsVisible and ModConfigMenu.Config["Mod Config Menu"].HideHudInMenu and EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" and EID.MCMCompat_isDisplayingEIDTab ~= "Crafting" then --if the mod config menu exists, is opened and Hide Hud is enabled, and ModConfigMenu isn't currently in the "Visuals" or "Crafting" tab of EID return @@ -1049,15 +1033,14 @@ local function onRender(t) local closest = EID.lastDescriptionEntity - + + -- if no entity in range, display Sacrifice Room information if EID.lastDist / 40 > tonumber(EID.Config["MaxDistance"]) then if game:GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] then local curRoomIndex = game:GetLevel():GetCurrentRoomIndex() local curCounter = EID.sacrificeCounter[curRoomIndex] or 1 local sacrificeDesc = EID:getDescriptionObj(-999, -1, curCounter) sacrificeDesc.Name = sacrificeDesc.Name.." ("..curCounter.."/12)" - EID:alterTextPos(Vector(EID.Config["XPosition"], EID.Config["YPosition"])) - EID.Scale = EID.Config["Size"] EID:printDescription(sacrificeDesc) end return @@ -1072,11 +1055,9 @@ local function onRender(t) --Handle Indicators EID:renderIndicator(closest) - --Local Mode + --Position the description under the entity in Local Mode EID:PositionLocalMode(closest) - --Scale Value - EID:ScaleValue(closest) --Handle GetData Entities (specific) if EID.Config["EnableEntityDescriptions"] and EID:getEntityData(closest, "EID_Description") then local desc = EID:getEntityData(closest, "EID_Description") @@ -1100,9 +1081,10 @@ local function onRender(t) -- force the default glitchy description if option is off if not EID.Config["DisplayGlitchedItemInfo"] then glitchedObj.Description = glitchedDesc - -- grab the Item Config info if eid_tmtrainer.lua hasn't taken care of it - elseif not debug then - glitchedObj.Description = EID:CheckGlitchedItemConfig(closest.SubType) .. glitchedDesc + -- grab the Item Config info if eid_tmtrainer.lua hasn't taken care of it, and it hasn't been done before + elseif not debug and glitchedObj.Description == glitchedDesc then + EID:addCollectible(closest.SubType, EID:CheckGlitchedItemConfig(closest.SubType) .. glitchedDesc) + glitchedObj = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType) end EID:printDescription(glitchedObj) @@ -1293,6 +1275,11 @@ if EID.MCMLoaded or REPENTANCE then 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 + EID.isHidden = EID.Config["InitiallyHidden"] EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) EID.Scale = EID.Config["Size"] From b85af9790c660a6d79b94d161a7bc2102d8892ec Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 04:39:57 -0500 Subject: [PATCH 04/21] improve modded check, add more comments --- eid_bagofcrafting.lua | 49 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/eid_bagofcrafting.lua b/eid_bagofcrafting.lua index 805ccbaf..ff4079d1 100644 --- a/eid_bagofcrafting.lua +++ b/eid_bagofcrafting.lua @@ -174,6 +174,7 @@ local componentShifts = { local poolToIcon = { [0]="{{TreasureRoom}}",[1]="{{Shop}}",[2]="{{BossRoom}}",[3]="{{DevilRoom}}",[4]="{{AngelRoom}}", [5]="{{SecretRoom}}",[7]="{{PoopRoomIcon}}",[8]="{{GoldenChestRoomIcon}}",[9]="{{RedChestRoomIcon}}",[12]="{{CursedRoom}}",[26]="{{Planetarium}}" } +-- local copies of our XML data in case it's slightly faster local CraftingMaxItemID = EID.XMLMaxItemID local CraftingFixedRecipes = EID.XMLRecipes local CraftingItemPools = EID.XMLItemPools @@ -208,7 +209,7 @@ local function sortAllItems() end end) end --- delay the initial sort until needed, as it's a tad slow +-- delay the initial sort until needed, in case of modded items local sortNeeded = true local recheckPickups = false @@ -350,28 +351,27 @@ function EID:simulateBagOfCrafting(componentsTable) end -- The main function that takes 8 ingredients and tells you what collectible you will get in return +-- Only pass in a table with 8 valid ingredients!!! function EID:calculateBagOfCrafting(componentsTable) + -- ingredients must be sorted by ID for the RNG shifting to be accurate, so make a local copy local components = {table.unpack(componentsTable)} - if components == nil or #components ~= 8 then - return 0 - end - - customRNGSeed = lastSeedUsed table.sort(components) local componentsAsString = table.concat(components, ",") - --Check the fixed recipes. Currently, the fixed recipes ignore item unlock status + -- Check the fixed recipes. Currently, the fixed recipes ignore item unlock status local cacheResult = CraftingFixedRecipes[componentsAsString] if cacheResult ~= nil then return cacheResult, cacheResult end - + -- Check the recipes already calculated for this seed cacheResult = calculatedRecipes[componentsAsString] local lockedResult = lockedRecipes[componentsAsString] - if cacheResult ~= nil then return cacheResult, lockedResult end + + -- Count up the ingredients, and shift the RNG based on the components in the bag + customRNGSeed = lastSeedUsed local compTotalWeight = 0 local compCounts = {} for i = 1, #componentShifts do @@ -384,6 +384,7 @@ function EID:calculateBagOfCrafting(componentsTable) RNGNext() end customRNGShift = componentShifts[7] + local poolWeights = { {idx = 0, weight = 1}, {idx = 1, weight = 2}, @@ -401,11 +402,8 @@ function EID:calculateBagOfCrafting(componentsTable) end local totalWeight = 0 - local itemWeights = {} - - local maxItemID = CraftingMaxItemID - for i = 1, maxItemID do + for i = 1, CraftingMaxItemID do itemWeights[i] = 0 end @@ -414,6 +412,7 @@ function EID:calculateBagOfCrafting(componentsTable) local qualityMin = 0 local qualityMax = 1 local n = compTotalWeight + -- Devil, Angel, and Secret Room Pools have a 5 point penalty if (poolWeight.idx >= 3) and (poolWeight.idx <= 5) then n = n - 5 end @@ -456,8 +455,8 @@ function EID:calculateBagOfCrafting(componentsTable) --That 2nd pick could also be achievement locked but we're ignoring that... local firstOption = nil while true do - local t = nextFloat() - local target = t * totalWeight + local t = nextFloat() -- number between 0 and 1 + local target = t * totalWeight -- number between 0 and total weight of possible results for k,v in ipairs(itemWeights) do target = target - v if target < 0 then @@ -530,11 +529,11 @@ local moddedCrafting = false -- Check for modded items past the known max item ID on game start (can also support game updates) -- Only works if the new items are at Weight 1.0 in their item pools, but better than nothing local function GameStartCrafting() + local timer = Isaac.GetTime() if not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) and EID.itemConfig:GetCollectible(EID.XMLMaxItemID+1) ~= nil then - -- Items past max ID detected; copy our XML tables so we can add to them - CraftingMaxItemID = EID.XMLMaxItemID - CraftingItemPools = deepcopy(EID.XMLItemPools) - CraftingItemQualities = deepcopy(EID.XMLItemQualities) + dofile("eid_xmldata") + -- Items past max ID detected + CraftingMaxItemID = EID.XMLMaxItemID -- XMLMaxItemID is never modified -- Add new item qualities local coll = EID.itemConfig:GetCollectible(CraftingMaxItemID+1) while coll ~= nil do @@ -559,12 +558,12 @@ local function GameStartCrafting() moddedCrafting = true sortNeeded = true elseif moddedCrafting then - CraftingMaxItemID = EID.XMLMaxItemID - CraftingItemPools = EID.XMLItemPools - CraftingItemQualities = EID.XMLItemQualities + -- the modded items were disabled + dofile("eid_xmldata") moddedCrafting = false sortNeeded = true end + print(Isaac.GetTime() - timer) end EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, GameStartCrafting) @@ -768,7 +767,7 @@ end local function getFloorItemsString(showPreviews, roomItems) local floorString = "" if #EID.BagItems >0 then - if showPreviews and #EID.BagItems >= 8 then + if showPreviews and #EID.BagItems == 8 then local recipe = EID:calculateBagOfCrafting(EID.BagItems) floorString = floorString .. "{{Collectible"..recipe.."}} " end @@ -916,7 +915,7 @@ function EID:handleBagOfCraftingRendering() end -- Determine if we should display anything at all - if EID.isHidden or craftingIsHidden or game.Challenge == Challenge.CHALLENGE_CANTRIPPED then + if ((EID.isHidden or craftingIsHidden) and EID.MCMCompat_isDisplayingEIDTab ~= "Crafting") or game.Challenge == Challenge.CHALLENGE_CANTRIPPED then return elseif EID.Config["BagOfCraftingHideInBattle"] then if Isaac.CountBosses() > 0 or Isaac.CountEnemies() > 0 then @@ -934,7 +933,7 @@ function EID:handleBagOfCraftingRendering() end -- Display the result of the 8 items in our bag if applicable - if (showCraftingResult or EID.Config["BagOfCraftingDisplayMode"] == "Preview Only") and #EID.BagItems >= 8 then + if (showCraftingResult or EID.Config["BagOfCraftingDisplayMode"] == "Preview Only") and #EID.BagItems == 8 then local craftingResult, backupResult = EID:calculateBagOfCrafting(EID.BagItems) if (backupResult ~= craftingResult) then EID.TabPreviewID = backupResult end local descriptionObj = EID:getDescriptionObj(5, 100, craftingResult) From d073192e868f1686ccd8cd6cada8db0c984a180f Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 04:41:45 -0500 Subject: [PATCH 05/21] MCM rework in progress --- mod_config_menu.lua | 394 ++++++++------------------------------------ 1 file changed, 70 insertions(+), 324 deletions(-) diff --git a/mod_config_menu.lua b/mod_config_menu.lua index 6c43464d..97b61dfb 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -35,7 +35,7 @@ local function renderDummyDesc(reload) demoDescObj.Name = EID:getDescriptionEntry("MCM","DemoObjectName") demoDescObj.Transformation = EID:getDescriptionEntry("MCM","DemoObjectTransformation") demoDescObj.Description = EID:getDescriptionEntry("MCM","DemoObjectText") - EID:displayPermanentText(demoDescObj) + EID:displayPermanentText(demoDescObj, "MCM", "DemoObjectName") end -- get list of all defined fonts per language file @@ -143,6 +143,32 @@ function EID:AddBooleanSetting(category, optionName, displayText, params) ) end +function EID:AddNumberSetting(category, optionName, displayText, minimum, maximum, params) + if type(params) ~= "table" then params = {} end + if params.repOnly and not REPENTANCE then return end + MCM.AddSetting( + "EID", category, + { + Type = ModConfigMenu.OptionType.NUMBER, + CurrentSetting = params.currentSettingFunc or function() + return (params.indexOf and AnIndexOf(params.indexOf, EID.Config[optionName])) or EID.Config[optionName] + end, + Minimum = minimum, + Maximum = maximum, + ModifyBy = params.modifyBy or 1, + Display = params.displayFunc or function() + if params.displayingTab then EID.MCMCompat_isDisplayingEIDTab = params.displayingTab end + return displayText .. ": " .. ((params.displayTable and params.displayTable[EID.Config[optionName]]) or EID.Config[optionName]) + end, + OnChange = params.onChangeFunc or function(currentNum) + EID.Config[optionName] = (params.indexOf and params.indexOf[currentNum]) or currentNum + EID.MCM_OptionChanged = true + end, + Info = params.infoText or {} + } + ) +end + function EID:AddHotkeySetting(category, optionName, displayText, infoText, isController) if (type(infoText) == "string") then infoText = {infoText} end local optionType = ModConfigMenu.OptionType.KEYBIND_KEYBOARD @@ -211,8 +237,15 @@ if MCMLoaded then MCM.AddSpace("EID", "Info") MCM.AddText("EID", "Info", function() return EID.isHidden and"~~~~~~~~~~~~~~~~~~~~~~~~~~~" or "" end) MCM.AddText("EID", "Info", function() return EID.isHidden and"~~~~~ CURRENTLY HIDDEN! ~~~~~" or "" end) - MCM.AddText("EID", "Info", function() return EID.isHidden and"~~~~~~~~ F2 to show ~~~~~~~~~" or "" end) - + MCM.AddText("EID", "Info", function() + if EID.Config["HideKey"] ~= -1 or EID.Config["HideButton"] ~= -1 then + local hotkeyString = InputHelper.KeyboardToString[EID.Config["HideKey"]] or InputHelper.ControllerToString[EID.Config["HideButton"]] + return EID.isHidden and ("~~~~~~~ " .. hotkeyString .." to show ~~~~~~~~") or "" + else + return EID.isHidden and"~~ bind a key/button in the General tab to show ~~" or "" + end + end) + --------------------------------------------------------------------------- ---------------------------------General----------------------------------- -- Language @@ -245,306 +278,41 @@ if MCMLoaded then ) -- Item Name Language local translateStates = {"English", "Current Language", "Current + English"} - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return EID.Config["TranslateItemName"] - end, - Minimum = 1, - Maximum = 3, - Display = function() - return "Name Language: " .. translateStates[EID.Config["TranslateItemName"]] - end, - OnChange = function(currentNum) - EID.Config["TranslateItemName"] = currentNum - end, - Info = {"If translated names are available,","this changes how item names are displayed."} - } - ) + EID:AddNumberSetting("General", "TranslateItemName", "Name Language", 1, 3, {displayTable = translateStates, + infoText = {"If translated names are available,","this changes how item names are displayed."}}) - -- Hide Key - EID:AddHotkeySetting("General", - "HideKey", "Toggle (Keyboard)", + -- Hide Keys + EID:AddHotkeySetting("General", "HideKey", "Toggle (Keyboard)", "Press this key to toggle the description display", false) - EID:AddHotkeySetting("General", - "HideButton", "Toggle (Controller)", + EID:AddHotkeySetting("General", "HideButton", "Toggle (Controller)", "Press this button to toggle the description display (Left Stick or Right Stick recommended; most other buttons will not work)", true) MCM.AddSpace("EID", "General") - -- Position X - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return EID.Config["XPosition"] - end, - Minimum = 0, - Maximum = 500, - ModifyBy = 5, - Display = function() - return "Position X: " .. EID.Config["XPosition"] - end, - OnChange = function(currentNum) - EID.Config["XPosition"] = currentNum - EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) - end, - Info = {"Default = 60"} - } - ) - -- Position Y - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return EID.Config["YPosition"] - end, - Minimum = 0, - Maximum = 500, - ModifyBy = 5, - Display = function() - return "Position Y: " .. EID.Config["YPosition"] - end, - OnChange = function(currentNum) - EID.Config["YPosition"] = currentNum - EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) - end, - Info = {"Default = 45"} - } - ) - -- Line Height - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return EID.Config["LineHeight"] - end, - Minimum = 1, - Maximum = 100, - Display = function() - return "Line Height: " .. EID.Config["LineHeight"] - 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"} - } - ) - -- Textbox Width - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return EID.Config["TextboxWidth"] - end, - Minimum = 1, - Maximum = 500, - ModifyBy = 5, - Display = function() - return "Textbox Width: " .. EID.Config["TextboxWidth"] - end, - OnChange = function(currentNum) - EID.Config["TextboxWidth"] = currentNum - EID.MCM_OptionChanged = true - end, - Info = {"Default = 130, varies per language","Width of the EID textbox, in pixels"} - } - ) - + EID:AddNumberSetting("General", "XPosition", "Position X", 0, 500, {modifyBy = 5, infoText = "Default = 60"}) + EID:AddNumberSetting("General", "YPosition", "Position Y", 0, 500, {modifyBy = 5, infoText = "Default = 45"}) + EID:AddNumberSetting("General", "LineHeight", "Line Height", 1, 30, {infoText = "Default = 11 (varies per language)"}) + EID:AddNumberSetting("General", "TextboxWidth", "Textbox Width", 1, 500, {modifyBy = 5, infoText = "Default = 130 (varies per language)"}) MCM.AddSpace("EID", "General") - -- Initial hiding - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["InitiallyHidden"] - end, - Display = function() - local onOff = "False" - if EID.Config["InitiallyHidden"] then - onOff = "True" - end - return 'Is initially Hidden: ' .. onOff - end, - OnChange = function(currentBool) - EID.Config["InitiallyHidden"] = currentBool - end - } - ) + EID:AddBooleanSetting("General", "InitiallyHidden", "Is Initially Hidden") + EID:AddBooleanSetting("General", "DisableStartOfRunWarnings", "Start of Run Warnings", {offText = "Enabled", onText = "Disabled", + repOnly = true, infoText = "Toggle the achievement, outdated game version, and modded crafting recipes warnings"}) - if REPENTANCE then - -- disable the warnings that display at the start of new runs - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisableAchievementCheck"] - end, - Display = function() - local onOff = "Enabled" - if EID.Config["DisableAchievementCheck"] then - onOff = "Disabled" - end - return "Start of Run Warnings: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisableAchievementCheck"] = currentBool - end, - Info = {"Toggle the achievement, outdated game version, and modded crafting recipes warnings"} - } - ) - end + EID:AddBooleanSetting("General", "DisableOnCurse", 'Show on "Curse of the Blind"', {offText = "True", onText = "False"}) + EID:AddBooleanSetting("General", "DisableOnAprilFoolsChallenge", "Show on April Fools Challenge", {offText = "True", onText = "False"}) + EID:AddBooleanSetting("General", "DisableOnAltPath", "Show Hidden Alt-Path Item", {offText = "True", onText = "False", + repOnly = true, infoText = "Show the description for the blind item in Downpour/Mines/etc."}) - -- Disable on Curse - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisableOnCurse"] - end, - Display = function() - local onOff = "True" - if EID.Config["DisableOnCurse"] then - onOff = "False" - end - return 'Show on "Curse of Blind": ' .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisableOnCurse"] = currentBool - end - } - ) - -- Disable April Fools - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisableOnAprilFoolsChallenge"] - end, - Display = function() - local onOff = "True" - if EID.Config["DisableOnAprilFoolsChallenge"] then - onOff = "False" - end - return 'Show on April Fools Challenge: ' .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisableOnAprilFoolsChallenge"] = currentBool - end - } - ) - - if REPENTANCE then - -- Disable Alt Item option - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisableOnAltPath"] - end, - Display = function() - local onOff = "True" - if EID.Config["DisableOnAltPath"] then - onOff = "False" - end - return 'Show hidden alt-Path Item: ' .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisableOnAltPath"] = currentBool - end - } - ) - end - - --------ShowUnidentifiedPillDescriptions--------- - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["ShowUnidentifiedPillDescriptions"] - end, - Display = function() - local onOff = "False" - if EID.Config["ShowUnidentifiedPillDescriptions"] then - onOff = "True" - end - return "Show Unidentified Pill Effects: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["ShowUnidentifiedPillDescriptions"] = currentBool - end - } - ) - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["HideInBattle"] - end, - Display = function() - local onOff = "False" - if EID.Config["HideInBattle"] then - onOff = "True" - end - return "Hide in Battle: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["HideInBattle"] = currentBool - end, - Info = {"Hides the descriptions when in a fight"} - } - ) + EID:AddBooleanSetting("General", "ShowUnidentifiedPillDescriptions", "Show Unidentified Pill Effects") + EID:AddBooleanSetting("General", "HideInBattle", "Hide in Battle", {infoText = "Hides the descriptions when in a fight"}) MCM.AddSpace("EID", "General") --indicator local indicators = {"arrow", "blink", "border", "highlight", "none"} - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return AnIndexOf(indicators, EID.Config["Indicator"]) - end, - Minimum = 1, - Maximum = 5, - Display = function() - return "Indicator: " .. EID.Config["Indicator"] - end, - OnChange = function(currentNum) - EID.Config["Indicator"] = indicators[currentNum] - end, - Info = {"Highlights the currently described item"} - } - ) + EID:AddNumberSetting("General", "Indicator", "Indicator", 1, 5, {indexOf = indicators, + infoText = {"Change how the currently described item is marked"}}) MCM.AddSpace("EID", "General") @@ -894,45 +662,23 @@ if MCMLoaded then } ) - -- SCALE - local textScales = {0.5, 0.75, 1, 1.25, 1.5, 2} - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - if EID.Config["DisplayMode"] == "local" then - return AnIndexOf(textScales, EID.Config["LocalModeSize"]) - else - return AnIndexOf(textScales, EID.Config["Size"]) - end - end, - Minimum = 1, - Maximum = 6, - Display = function() - if EID.Config["DisplayMode"] == "local" then - return "Text Size (Local mode): " .. EID.Config["LocalModeSize"] - else - return "Text Size: " .. EID.Config["Size"] - end - end, - OnChange = function(currentNum) - EID.MCM_OptionChanged = true - if EID.Config["DisplayMode"] == "local" then - EID.Config["LocalModeSize"] = textScales[currentNum] - else - EID.Config["Size"] = textScales[currentNum] - end - EID.Scale = textScales[currentNum] - end, - Info = {"Change text size","CAN BE HARD TO READ IN SOME SETTINGS!"} - } - ) + -- SCALE + EID:AddNumberSetting("Visuals", "Size", "Text Size", 0.5, 2, {modifyBy = 0.25, onChangeFunc = + function(currentNum) + EID.MCM_OptionChanged = true + currentNum = currentNum - (currentNum % 0.25) + EID.Config["Size"] = currentNum + end}) + EID:AddNumberSetting("Visuals", "LocalModeSize", "Text Size (Local Mode)", 0.5, 2, {modifyBy = 0.25, onChangeFunc = + function(currentNum) + EID.MCM_OptionChanged = true + currentNum = currentNum - (currentNum % 0.25) + EID.Config["LocalModeSize"] = currentNum + end}) -- SCALE Hotkey EID:AddHotkeySetting("Visuals", "SizeHotkey", "Toggle Size (Keyboard)", - {"Press this key to change the text size.", "Hold this key to smoothly change the text size"}, false) + {"Press this key to change the text size.", "Hold this key to smoothly change the text size."}, false) -- Local Mode Centered or not MCM.AddSetting( From 52086d4a8f32941f57c86033935760d5cc2b0f38 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:11:50 -0500 Subject: [PATCH 06/21] Add func to check if a font name is valid in the current language --- eid_api.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eid_api.lua b/eid_api.lua index 5e8d8601..d97f9624 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -1219,6 +1219,16 @@ function EID:fixDefinedFont() EID.Config["TextboxWidth"] = EID.descriptions[curLang].fonts[1].textboxWidth or EID.DefaultConfig["TextboxWidth"] return true end +-- Check if a given font name is valid for the currently selected language +function EID:canUseFontType(fontType) + local curLang = EID.Config["Language"] + for _, v in ipairs(EID.descriptions[curLang].fonts) do + if fontType == v.name then + return true + end + end + return false +end -- Creates a copy of a KColor object. This prevents overwriting existing function EID:copyKColor(colorObj) From 2b1a310fefc569664460e220580312b1ffe203ac Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:12:12 -0500 Subject: [PATCH 07/21] fix the Crafting option preview allowing other descs afterwards --- main.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.lua b/main.lua index 1c4c565a..5c93319f 100644 --- a/main.lua +++ b/main.lua @@ -992,10 +992,13 @@ local function onRender(t) if REPENTANCE and EID.player:HasCollectible(710) then local success = EID:handleBagOfCraftingRendering() + -- If the Bag of Crafting did rendering, don't display any other description if success then return end end + -- If we're in the Crafting options tab, the only rendering we want to happen is the Bag of Crafting + if EID.MCMCompat_isDisplayingEIDTab == "Crafting" then return end EID.lastDescriptionEntity = nil EID.lastDist = 10000 From 7f91bbcd5205dca1908f296507ed5b9ce100bb8a Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:12:36 -0500 Subject: [PATCH 08/21] move collection page to AB+ modifiers --- eid_modifiers.lua | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/eid_modifiers.lua b/eid_modifiers.lua index 9b793c65..f28b0639 100644 --- a/eid_modifiers.lua +++ b/eid_modifiers.lua @@ -120,6 +120,15 @@ local function BlackRuneCallback(descObj) return VoidCallback(descObj, true) end +-- Handle Item Collection description addition +local function ItemCollectionPageCallback(descObj) + descObj.Name = "{{"..EID.Config["ItemCollectionColor"].."}}"..descObj.Name + local text = EID:getDescriptionEntry("CollectionPageInfo") + + EID:appendToDescription(descObj, "#{{Warning}} "..text) + return descObj +end + if REPENTANCE then -- Handle Birthright @@ -403,20 +412,13 @@ if REPENTANCE then return descObj end - -- Handle Item Collection description addition - local function ItemCollectionPageCallback(descObj) - descObj.Name = "{{"..EID.Config["ItemCollectionColor"].."}}"..descObj.Name - local text = EID:getDescriptionEntry("CollectionPageInfo") - - EID:appendToDescription(descObj, "#{{Warning}} "..text) - return descObj - end -------------------------------- -- Although individual conditions/callbacks work well for mods to be able to add through the API, -- As we kept adding callbacks for vanilla items, a lot of code got repeated over and over -- This one-condition setup fixes that and can only help performance -- It also allows us to pick the order that modifiers are appended to descriptions (stats/effects first, then reroll/flip/recharge info) + -- REPENTANCE-ONLY MODIFIERS local function EIDConditions(descObj) -- currently, only pickup descriptions have modifiers if descObj.ObjType ~= 5 then return false end @@ -430,8 +432,6 @@ if REPENTANCE then -- Using magic numbers here in case it's slightly faster, and because the callback names give context -- Check Birthright first because it overwrites the description instead of appending to it if descObj.ObjSubType == 619 then table.insert(callbacks, BirthrightCallback) end - - if EID:requiredForCollectionPage(descObj.ObjSubType) then table.insert(callbacks, ItemCollectionPageCallback) end if collectiblesOwned[664] then table.insert(callbacks, BingeEaterCallback) end if collectiblesOwned[59] then table.insert(callbacks, BookOfBelialCallback) end @@ -439,7 +439,7 @@ if REPENTANCE then if collectiblesOwned[706] or (EID.absorbedItems[706] and collectiblesOwned[477]) then table.insert(callbacks, AbyssCallback) end 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])) and descObj.ObjSubType ~= 668 then table.insert(callbacks, SpindownDiceCallback) end + if EID.Config["SpindownDiceResults"] > 0 and (collectiblesOwned[723] or (EID.absorbedItems[723] and collectiblesOwned[477])) and descObj.ObjSubType ~= 668 then table.insert(callbacks, SpindownDiceCallback) end -- Card / Rune Callbacks elseif descObj.ObjVariant == PickupVariant.PICKUP_TAROTCARD then @@ -466,6 +466,7 @@ if REPENTANCE then end +-- AFTERBIRTH+ OR REPENTANCE MODIFIERS local function EIDConditionsAB(descObj) -- currently, only pickup descriptions have modifiers if descObj.ObjType ~= 5 then return false end @@ -476,6 +477,8 @@ local function EIDConditionsAB(descObj) -- Collectible Pedestal Callbacks if descObj.ObjVariant == PickupVariant.PICKUP_COLLECTIBLE then + if EID:requiredForCollectionPage(descObj.ObjSubType) then table.insert(callbacks, ItemCollectionPageCallback) end + if EID.Config["DisplayVoidStatInfo"] then if collectiblesOwned[477] then table.insert(callbacks, VoidCallback) end if blackRuneOwned then table.insert(callbacks, BlackRuneCallback) end From f6782e6c99ee29fd1c8e99103173c1ab9d4a9f6e Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:14:01 -0500 Subject: [PATCH 09/21] MCM rewrite + bug fixes --- mod_config_menu.lua | 566 ++++++++------------------------------------ 1 file changed, 105 insertions(+), 461 deletions(-) diff --git a/mod_config_menu.lua b/mod_config_menu.lua index 97b61dfb..88dd262c 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -168,6 +168,30 @@ function EID:AddNumberSetting(category, optionName, displayText, minimum, maximu } ) end + +function EID:AddScrollSetting(category, optionName, displayText, scrollTable, params) + if type(params) ~= "table" then params = {} end + if params.repOnly and not REPENTANCE then return end + MCM.AddSetting( + "EID", category, + { + Type = ModConfigMenu.OptionType.SCROLL, + CurrentSetting = params.currentSettingFunc or function() + return AnIndexOf(scrollTable, EID.Config[optionName]) - 1 + end, + Display = params.displayFunc or function() + if params.displayingTab then EID.MCMCompat_isDisplayingEIDTab = params.displayingTab end + return displayText .. ": $scroll" .. (AnIndexOf(scrollTable, EID.Config[optionName]) - 1) .. " " .. + EID.Config[optionName] .. (params.label or "") + end, + OnChange = params.onChangeFunc or function(currentNum) + EID.Config[optionName] = scrollTable[currentNum + 1] + EID.MCM_OptionChanged = true + end, + Info = params.infoText or {} + } + ) +end function EID:AddHotkeySetting(category, optionName, displayText, infoText, isController) if (type(infoText) == "string") then infoText = {infoText} end @@ -238,6 +262,7 @@ if MCMLoaded then MCM.AddText("EID", "Info", function() return EID.isHidden and"~~~~~~~~~~~~~~~~~~~~~~~~~~~" or "" end) MCM.AddText("EID", "Info", function() return EID.isHidden and"~~~~~ CURRENTLY HIDDEN! ~~~~~" or "" end) MCM.AddText("EID", "Info", function() + EID.MCMCompat_isDisplayingEIDTab = "" if EID.Config["HideKey"] ~= -1 or EID.Config["HideButton"] ~= -1 then local hotkeyString = InputHelper.KeyboardToString[EID.Config["HideKey"]] or InputHelper.ControllerToString[EID.Config["HideButton"]] return EID.isHidden and ("~~~~~~~ " .. hotkeyString .." to show ~~~~~~~~") or "" @@ -289,6 +314,7 @@ if MCMLoaded then MCM.AddSpace("EID", "General") + -- Position / Textbox Size EID:AddNumberSetting("General", "XPosition", "Position X", 0, 500, {modifyBy = 5, infoText = "Default = 60"}) EID:AddNumberSetting("General", "YPosition", "Position Y", 0, 500, {modifyBy = 5, infoText = "Default = 45"}) EID:AddNumberSetting("General", "LineHeight", "Line Height", 1, 30, {infoText = "Default = 11 (varies per language)"}) @@ -318,24 +344,8 @@ if MCMLoaded then -- maxDistance local distances = {1, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10} - MCM.AddSetting( - "EID", - "General", - { - Type = ModConfigMenu.OptionType.SCROLL, - CurrentSetting = function() - return AnIndexOf(distances, EID.Config["MaxDistance"]) - 1 - end, - Display = function() - return "Max Distance: $scroll" .. - AnIndexOf(distances, EID.Config["MaxDistance"]) - 1 .. " " .. EID.Config["MaxDistance"] .. " Grids" - end, - OnChange = function(currentNum) - EID.Config["MaxDistance"] = distances[currentNum + 1] - end, - Info = {"Distance to the object until descriptions are displayed."} - } - ) + EID:AddScrollSetting("General", "MaxDistance", "Max Distance", distances, {label = " Grids", + infoText = "Distance to the object until descriptions are displayed."}) --------Reset to default MCM.AddSpace("EID", "General") @@ -347,8 +357,15 @@ if MCMLoaded then Type = ModConfigMenu.OptionType.BOOLEAN, CurrentSetting = function() return true end, Display = function() return "<---- RESET CONFIG TO DEFAULT ---->" end, - OnChange = function(currentBool) EID.Config = EID.DefaultConfig end, - Info = {"Press this reset the config back to its default values"} + OnChange = function(currentBool) + local resetFont = (EID.Config["FontType"] ~= "default") + for k,v in pairs(EID.DefaultConfig) do EID.Config[k] = v end + EID.MCM_OptionChanged = true + EID.RefreshBagTextbox = true + if resetFont then EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt") end + renderDummyDesc(true) + end, + Info = {"Press this to reset the config back to its default values"} } ) @@ -367,247 +384,49 @@ if MCMLoaded then EID:AddBooleanSetting("Display", "DisplayCraneInfo", "Crane Game Infos", {repOnly = true}) EID:AddBooleanSetting("Display", "DisplayVoidStatInfo", "Void Stat Increase Infos") - local diceSteps = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} - if REPENTANCE then - - MCM.AddSpace("EID", "Display") + local diceSteps = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} + -- Spindown Dice Settings + if REPENTANCE then MCM.AddSpace("EID", "Display") end - -- Spindown Dice results - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.SCROLL, - CurrentSetting = function() - return AnIndexOf(diceSteps, EID.Config["SpindownDiceResults"]) - 1 - end, - Display = function() - return "Spindown Dice: $scroll" .. - AnIndexOf(diceSteps, EID.Config["SpindownDiceResults"]) - 1 .. " " .. EID.Config["SpindownDiceResults"] .. " Items" - end, - OnChange = function(currentNum) - EID.Config["SpindownDiceResults"] = diceSteps[currentNum + 1] - end, - Info = {"Preview of Items resulting when using the Spindown dice X times"} - } - ) - -- - -- Display IDs for Spindown Dice results - EID:AddBooleanSetting("Display", "SpindownDiceDisplayID", "Display IDs", - {repOnly = true, infoText = "Display IDs for Spindown Dice results"}) - -- Display names for Spindown Dice results - EID:AddBooleanSetting("Display", "SpindownDiceDisplayName", "Display names", - {repOnly = true, infoText = "Display names for Spindown Dice results"}) - - -- Spindown Dice skip locked items - EID:AddBooleanSetting("Display", "SpindownDiceSkipLocked", "Skip Locked Items", - {repOnly = true, infoText = "Skip locked items in the preview just as the dice will; the method to check for unlock status is not perfect, though"}) - end + EID:AddScrollSetting("Display", "SpindownDiceResults", "Spindown Dice", diceSteps, {repOnly = true, label = " Items", + infoText = "Number of item previews when holding Spindown Dice"}) + + -- Display IDs for Spindown Dice results + EID:AddBooleanSetting("Display", "SpindownDiceDisplayID", "Display IDs", + {repOnly = true, infoText = "Display IDs for Spindown Dice results"}) + -- Display names for Spindown Dice results + EID:AddBooleanSetting("Display", "SpindownDiceDisplayName", "Display names", + {repOnly = true, infoText = "Display names for Spindown Dice results"}) + -- Spindown Dice skip locked items + EID:AddBooleanSetting("Display", "SpindownDiceSkipLocked", "Skip Locked Items", + {repOnly = true, infoText = "Skip locked items in the preview just as the dice will; the method to check for unlock status is not perfect, though"}) --------Obstruction--------- MCM.AddSpace("EID", "Display") - MCM.AddText("EID", "Display", "Display Infos when obstructed") + MCM.AddText("EID", "Display", "Display Infos when Obstructed") - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisableObstructionOnFlight"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisableObstructionOnFlight"] then - onOff = "True" - end - return "Show again when having flight: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisableObstructionOnFlight"] = currentBool - end - } - ) + EID:AddBooleanSetting("Display", "DisableObstructionOnFlight", "Show again when you have Flight") + EID:AddBooleanSetting("Display", "DisplayObstructedCardInfo", "Obstructed Card Infos") + EID:AddBooleanSetting("Display", "DisplayObstructedPillInfo", "Obstructed Pill Infos") + EID:AddBooleanSetting("Display", "DisplayObstructedSoulstoneInfo", "Obstructed Soulstone Infos", {repOnly = true}) - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisplayObstructedCardInfo"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisplayObstructedCardInfo"] then - onOff = "True" - end - return "Card Infos: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisplayObstructedCardInfo"] = currentBool - end - } - ) - - if REPENTANCE then - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisplayObstructedSoulstoneInfo"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisplayObstructedSoulstoneInfo"] then - onOff = "True" - end - return "Soulstone Infos: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisplayObstructedSoulstoneInfo"] = currentBool - end - } - ) - end - - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisplayObstructedPillInfo"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisplayObstructedPillInfo"] then - onOff = "True" - end - return "Pill Infos: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisplayObstructedPillInfo"] = currentBool - end - } - ) - + -------Shop Spoilers------- MCM.AddSpace("EID", "Display") MCM.AddText("EID", "Display", "Display Infos in Shops") - ------------CARDS-------------- - - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisplayCardInfoShop"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisplayCardInfoShop"] then - onOff = "True" - end - return "Card Infos: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisplayCardInfoShop"] = currentBool - end - } - ) - - ------------PILLS-------------- - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisplayPillInfoShop"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisplayPillInfoShop"] then - onOff = "True" - end - return "Pill Infos: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisplayPillInfoShop"] = currentBool - end - } - ) + EID:AddBooleanSetting("Display", "DisplayCardInfoShop", "Shop Card Infos") + EID:AddBooleanSetting("Display", "DisplayPillInfoShop", "Shop Pill Infos") + EID:AddBooleanSetting("Display", "DisplaySoulstoneInfoShop", "Shop Soulstone Infos", {repOnly = true}) + + ----"Options?" Spoilers---- if REPENTANCE then - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisplaySoulstoneInfoShop"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisplaySoulstoneInfoShop"] then - onOff = "True" - end - return "Soulstone Infos: " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisplaySoulstoneInfoShop"] = currentBool - end - } - ) - MCM.AddSpace("EID", "Display") MCM.AddText("EID", "Display", "Interaction with 'Options?'") - - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisplayCardInfoOptions?"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisplayCardInfoOptions?"] then - onOff = "True" - end - return "Card Infos when spawned by 'Options?': " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisplayCardInfoOptions?"] = currentBool - end - } - ) - - MCM.AddSetting( - "EID", - "Display", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["DisplayPillInfoOptions?"] - end, - Display = function() - local onOff = "False" - if EID.Config["DisplayPillInfoOptions?"] then - onOff = "True" - end - return "Pill Infos when spawned by 'Options?': " .. onOff - end, - OnChange = function(currentBool) - EID.Config["DisplayPillInfoOptions?"] = currentBool - end - } - ) end + + EID:AddBooleanSetting("Display", "DisplayCardInfoOptions?", "'Options?' Card Infos", {repOnly = true}) + EID:AddBooleanSetting("Display", "DisplayPillInfoOptions?", "'Options?' Pill Infos", {repOnly = true}) + --------------------------------------------------------------------------- ---------------------------------Visuals----------------------------------- -- Font Type @@ -626,43 +445,24 @@ if MCMLoaded then return "Font Type: " .. EID.Config["FontType"] end, OnChange = function(currentNum) - EID.Config["FontType"] = fontNames[currentNum] - EID.lineHeight = fonts[currentNum].lineHeight - EID.Config["TextboxWidth"] = fonts[currentNum].textboxWidth - EID:fixDefinedFont() - local fontFile = EID.Config["FontType"] or "default" - EID:loadFont(EID.modPath .. "resources/font/eid_"..fontFile..".fnt") + if EID:canUseFontType(fontNames[currentNum]) then + EID.MCM_OptionChanged = true + EID.Config["FontType"] = fontNames[currentNum] + EID.Config["LineHeight"] = fonts[currentNum].lineHeight or EID.Config["LineHeight"] + EID.Config["TextboxWidth"] = fonts[currentNum].textboxWidth or EID.Config["TextboxWidth"] + local fontFile = EID.Config["FontType"] or "default" + EID:loadFont(EID.modPath .. "resources/font/eid_"..fontFile..".fnt") + end end } ) -- 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( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return AnIndexOf(displayModes, EID.Config["DisplayMode"]) - end, - Minimum = 1, - Maximum = #displayModes, - Display = function() - return "Display mode: " .. EID.Config["DisplayMode"] - end, - OnChange = function(currentNum) - EID.Config["DisplayMode"] = displayModes[currentNum] - end, - Info = function() - return {"Changes display mode of descriptions", displayModeTips[AnIndexOf(displayModes, EID.Config["DisplayMode"])]} - end - } - ) + EID:AddNumberSetting("Visuals", "DisplayMode", "Display Mode", 1, #displayModes, {indexOf = displayModes, + infoText = {"Changes display mode of descriptions", "Default: Text is displayed in the top left.", "Local: Text is displayed under the described object."}}) - -- SCALE + -- Scale/Size EID:AddNumberSetting("Visuals", "Size", "Text Size", 0.5, 2, {modifyBy = 0.25, onChangeFunc = function(currentNum) EID.MCM_OptionChanged = true @@ -679,50 +479,12 @@ if MCMLoaded then EID:AddHotkeySetting("Visuals", "SizeHotkey", "Toggle Size (Keyboard)", {"Press this key to change the text size.", "Hold this key to smoothly change the text size."}, false) - -- Local Mode Centered or not - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["LocalModeCentered"] - end, - Display = function() - local onOff = "False" - if EID.Config["LocalModeCentered"] then - onOff = "True" - end - return "Local mode centered: " .. onOff - end, - OnChange = function(currentBool) - EID.MCM_OptionChanged = true - EID.Config["LocalModeCentered"] = currentBool - end - } - ) + EID:AddBooleanSetting("Visuals", "LocalModeCentered", "Local Mode Centered") -- Transparency local transparencies = {0.1, 0.175, 0.25, 0.3, 0.4, 0.5, 0.6, 0.75, 0.8, 0.9, 1} - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.SCROLL, - CurrentSetting = function() - return AnIndexOf(transparencies, EID.Config["Transparency"]) - 1 - end, - Display = function() - return "Transparency: $scroll" .. - AnIndexOf(transparencies, EID.Config["Transparency"]) - 1 .. " " .. EID.Config["Transparency"] - end, - OnChange = function(currentNum) - EID.MCM_OptionChanged = true - EID.Config["Transparency"] = transparencies[currentNum + 1] - end - } - ) + EID:AddScrollSetting("Visuals", "Transparency", "Transparency", transparencies) MCM.AddSpace("EID", "Visuals") @@ -737,25 +499,7 @@ if MCMLoaded then -------Mod indicator for modded items--------- local modIndicatorDisplays = {"Both","Name only","Icon only", "None"} - MCM.AddSetting( - "EID", - "Visuals", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return AnIndexOf(modIndicatorDisplays, EID.Config["ModIndicatorDisplay"]) - end, - Minimum = 1, - Maximum = #modIndicatorDisplays, - Display = function() - return "Mod indicator displayed for: " .. EID.Config["ModIndicatorDisplay"] - end, - OnChange = function(currentNum) - EID.MCM_OptionChanged = true - EID.Config["ModIndicatorDisplay"] = modIndicatorDisplays[currentNum] - end - } - ) + EID:AddNumberSetting("Visuals", "ModIndicatorDisplay", "Display Mod Indicator", 1, #modIndicatorDisplays, {indexOf = modIndicatorDisplays}) --------------------------------------------------------------------------- -----------------------------BAG OF CRAFTING------------------------------- @@ -763,144 +507,44 @@ if MCMLoaded then if REPENTANCE then -- Bag of Crafting Display local bagDisplays = {"always","hold","never"} - MCM.AddSetting( - "EID", - "Crafting", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return AnIndexOf(bagDisplays, EID.Config["DisplayBagOfCrafting"]) - end, - Minimum = 1, - Maximum = 3, - Display = function() - EID.MCMCompat_isDisplayingEIDTab = "Crafting" - 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"} - } - ) + EID:AddNumberSetting("Crafting", "DisplayBagOfCrafting", "Show Display", 1, #bagDisplays, { displayingTab = "Crafting", indexOf = bagDisplays, infoText = {"Always = Always show Results", "Hold = Show when holding up bag", "Never = Disable Bag of Crafting feature"}}) + -- Bag of Crafting Display Mode local bagDisplayModes = {"Recipe List","Preview Only","No Recipes","Pickups Only"} - MCM.AddSetting( - "EID", - "Crafting", - { - Type = ModConfigMenu.OptionType.NUMBER, - CurrentSetting = function() - return AnIndexOf(bagDisplayModes, EID.Config["BagOfCraftingDisplayMode"]) - end, - Minimum = 1, - Maximum = 4, - Display = function() - 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"} - } - ) + EID:AddNumberSetting("Crafting", "BagOfCraftingDisplayMode", "Display Mode", 1, #bagDisplayModes, { indexOf = bagDisplayModes, + infoText = {"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"}}) + -- Bag of Crafting Hide in Battle - EID:AddBooleanSetting("Crafting", "BagOfCraftingHideInBattle", "Hide in Battle", - {onText = "Yes", offText = "No", - infoText = "Hides the recipe list when in a fight"}) + EID:AddBooleanSetting("Crafting", "BagOfCraftingHideInBattle", "Hide in Battle", {onText = "Yes", offText = "No", + infoText = "Hides the recipe list when in a fight"}) -- Bag of Crafting 8 icons toggle - EID:AddBooleanSetting("Crafting", "BagOfCraftingDisplayIcons", "Show Recipes/Best Bag as", - {onText = "8 Icons", offText = "Groups", - infoText = "Choose if you want recipes (and the Best Quality bag in No Recipes Mode) shown as 8 icons, or as grouped ingredients"}) + EID:AddBooleanSetting("Crafting", "BagOfCraftingDisplayIcons", "Show Recipes/Best Bag as", {onText = "8 Icons", offText = "Groups", + infoText = "Choose if you want recipes (and the Best Quality bag in No Recipes Mode) shown as 8 icons, or as grouped ingredients"}) + -- Modded Recipes toggle + EID:AddBooleanSetting("Crafting", "BagOfCraftingModdedRecipes", "Load Modded Item Recipes", { + infoText = "Enable or disable modded item support; if you have a lot of modded items, it will slow down game launch"}) MCM.AddSpace("EID", "Crafting") MCM.AddText("EID", "Crafting", function() return "Recipe List Options" end) -- Bag of Crafting results per page - MCM.AddSetting( - "EID", - "Crafting", - { - Type = ModConfigMenu.OptionType.SCROLL, - CurrentSetting = function() - return AnIndexOf(diceSteps, EID.Config["BagOfCraftingResults"]) - 1 - end, - Display = function() - return "Displayed Results: $scroll" .. - 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"} - } - ) + local bagSteps = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} + EID:AddScrollSetting("Crafting", "BagOfCraftingResults", "Displayed Recipes", bagSteps, + { infoText = "Page size for the preview of items currently craftable with Bag of Crafting"}) + -- Bag of Crafting thorough recipe checks local combSteps = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18} - MCM.AddSetting( - "EID", - "Crafting", - { - Type = ModConfigMenu.OptionType.SCROLL, - CurrentSetting = function() - return AnIndexOf(combSteps, EID.Config["BagOfCraftingCombinationMax"]) - 1 - end, - Display = function() - return "Thorough Calculations: $scroll" .. - AnIndexOf(combSteps, EID.Config["BagOfCraftingCombinationMax"]) - 1 .. " " .. EID.Config["BagOfCraftingCombinationMax"] - end, - OnChange = function(currentNum) - EID.Config["BagOfCraftingCombinationMax"] = combSteps[currentNum + 1] - end, - Info = {"Get every recipe for the X best components; setting this high will cause lag spikes (12 = 500 combinations, 14 = 3,000, 16 = 13,000)"} - } - ) + EID:AddScrollSetting("Crafting", "BagOfCraftingCombinationMax", "Thorough Calculations", combSteps, + { infoText = {"Get every recipe for the X best components; setting this high slows down recipe checking", "(12 = 500 combinations, 14 = 3,000, 16 = 13,000)"}}) + -- Bag of Crafting random recipe checks local calcSteps = {200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200} - MCM.AddSetting( - "EID", - "Crafting", - { - Type = ModConfigMenu.OptionType.SCROLL, - CurrentSetting = function() - return AnIndexOf(calcSteps, EID.Config["BagOfCraftingRandomResults"]) - 1 - end, - Display = function() - return "Random Calculations: $scroll" .. - AnIndexOf(calcSteps, EID.Config["BagOfCraftingRandomResults"]) - 1 .. " " .. EID.Config["BagOfCraftingRandomResults"] - end, - OnChange = function(currentNum) - EID.Config["BagOfCraftingRandomResults"] = calcSteps[currentNum + 1] - end, - Info = {"An additional X number of randomly chosen recipes will be checked, changing each pickup spawn/despawn or refresh"} - } - ) + EID:AddScrollSetting("Crafting", "BagOfCraftingRandomResults", "Random Calculations", calcSteps, + { infoText = "An additional X number of randomly chosen recipes will be checked, changing each pickup spawn/despawn or refresh"}) + -- Bag of Crafting item names - MCM.AddSetting( - "EID", - "Crafting", - { - Type = ModConfigMenu.OptionType.BOOLEAN, - CurrentSetting = function() - return EID.Config["BagOfCraftingDisplayNames"] - end, - Display = function() - local onOff = "False" - if EID.Config["BagOfCraftingDisplayNames"] then - onOff = "True" - end - 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"} - } - ) + EID:AddBooleanSetting("Crafting", "BagOfCraftingDisplayNames", "Show Item Names", + { infoText = "If on, each recipe result takes two lines, one for the item name, one for the recipe"}) MCM.AddSpace("EID", "Crafting") From b1a34b8f5894b6e80a117e5f3b893a49e0d5a8fe Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:18:10 -0500 Subject: [PATCH 10/21] Modded Recipes option --- mod_config_menu.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_config_menu.lua b/mod_config_menu.lua index 88dd262c..3b2b14a7 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -522,7 +522,7 @@ if MCMLoaded then infoText = "Choose if you want recipes (and the Best Quality bag in No Recipes Mode) shown as 8 icons, or as grouped ingredients"}) -- Modded Recipes toggle EID:AddBooleanSetting("Crafting", "BagOfCraftingModdedRecipes", "Load Modded Item Recipes", { - infoText = "Enable or disable modded item support; if you have a lot of modded items, it will slow down game launch"}) + infoText = {"Enable or disable basic modded item support", "If you have a lot of modded items, it will slow down game launch"}}) MCM.AddSpace("EID", "Crafting") MCM.AddText("EID", "Crafting", function() return "Recipe List Options" end) From bf129f986899b9df036330142692b369aba7c9ac Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:18:26 -0500 Subject: [PATCH 11/21] add Modded Recipes toggle --- eid_config.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eid_config.lua b/eid_config.lua index 771099c3..e924a5f1 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -275,6 +275,11 @@ EID.UserConfig = { -- Display recipes as 8 icons instead of grouped ingredients -- Default = false ["BagOfCraftingDisplayIcons"] = false, + -- Enable or disable basic modded item support + -- Only modded items with a weight of 1.0 in their item pools are supported, as we can't determine modded item pool weight + -- If you have a lot of modded items, it will slow down game launch + -- Default = true + ["BagOfCraftingModdedRecipes"] = true, -- Set the keybinding to toggle the crafting display, so you can see descriptions of items/pickups on the floor -- Look into the AB+ or Repentance documentation for the key names here: https://wofsauge.github.io/IsaacDocs/rep/enums/Keyboard.html -- Default = Keyboard.KEY_F3 @@ -432,6 +437,7 @@ EID.DefaultConfig = { ["BagOfCraftingDisplayIcons"] = false, ["BagOfCraftingHideInBattle"] = true, ["BagOfCraftingDisplayMode"] = "Recipe List", + ["BagOfCraftingModdedRecipes"] = true, ["CraftingHideKey"] = Keyboard.KEY_F3, ["CraftingHideButton"] = -1, ["CraftingResultKey"] = Keyboard.KEY_F4, From cc3edf0aa2b4040312ef17c25d0d0d37b2c1aac3 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:21:58 -0500 Subject: [PATCH 12/21] Add modded recipes option --- eid_bagofcrafting.lua | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/eid_bagofcrafting.lua b/eid_bagofcrafting.lua index ff4079d1..8cd60cda 100644 --- a/eid_bagofcrafting.lua +++ b/eid_bagofcrafting.lua @@ -509,28 +509,11 @@ local function qualitySort(a, b) end end --- simple table of tables copy function, for modded recipe support (to make a local copy of the XML data tables so we can then add on to them) -local function deepcopy(orig) - local orig_type = type(orig) - local copy - if orig_type == 'table' then - copy = {} - for orig_key, orig_value in next, orig, nil do - copy[deepcopy(orig_key)] = deepcopy(orig_value) - end - setmetatable(copy, deepcopy(getmetatable(orig))) - else -- number, string, boolean, etc - copy = orig - end - return copy -end - local moddedCrafting = false -- Check for modded items past the known max item ID on game start (can also support game updates) -- Only works if the new items are at Weight 1.0 in their item pools, but better than nothing local function GameStartCrafting() - local timer = Isaac.GetTime() - if not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) and EID.itemConfig:GetCollectible(EID.XMLMaxItemID+1) ~= nil then + if EID.Config["BagOfCraftingModdedRecipes"] and not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) and EID.itemConfig:GetCollectible(EID.XMLMaxItemID+1) ~= nil then dofile("eid_xmldata") -- Items past max ID detected CraftingMaxItemID = EID.XMLMaxItemID -- XMLMaxItemID is never modified @@ -558,12 +541,11 @@ local function GameStartCrafting() moddedCrafting = true sortNeeded = true elseif moddedCrafting then - -- the modded items were disabled + -- we had modded items; they have since been disabled dofile("eid_xmldata") moddedCrafting = false sortNeeded = true end - print(Isaac.GetTime() - timer) end EID:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, GameStartCrafting) From 69b3a178b4898a3fe5c4df9ae711c0aaf22b2c57 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:31:32 -0500 Subject: [PATCH 13/21] Fix EID toggle key getting triggered while setting it --- main.lua | 87 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/main.lua b/main.lua index 5c93319f..fca3ec33 100644 --- a/main.lua +++ b/main.lua @@ -387,50 +387,48 @@ local scaleToBigger = true local scaleConfigName = "Size" local scaleHoldFrame = 0 local function handleScaleKey() - if not ModConfigMenu or not ModConfigMenu.IsVisible then - local scaleKey = EID.Config["SizeHotkey"] + local scaleKey = EID.Config["SizeHotkey"] - -- press and hold ScaleKey - if Input.IsButtonPressed(scaleKey, 0) then - if scaleHoldFrame > 60 then - EID.MCM_OptionChanged = true - local newScale - if scaleToBigger then - newScale = EID.Scale + scaleSpeed - if newScale > scaleMax then - scaleToBigger = false - end - else - newScale = EID.Scale - scaleSpeed - if newScale < scaleMin then - scaleToBigger = true - end - end - EID.Scale = newScale - EID.Config[scaleConfigName] = newScale - else - scaleHoldFrame = scaleHoldFrame + 1 - end - end - -- press ScaleKey - if Input.IsButtonTriggered(scaleKey, 0) then + -- press and hold ScaleKey + if Input.IsButtonPressed(scaleKey, 0) then + if scaleHoldFrame > 60 then EID.MCM_OptionChanged = true - scaleHoldFrame = 0 - local scale = EID.Scale - - -- switch between 1, 1.5 and 0.5 - if math.abs(scale - 1) < 0.01 then - scale = 1.5 - elseif math.abs(scale - 1.5) < 0.01 then - scale = 0.5 + local newScale + if scaleToBigger then + newScale = EID.Scale + scaleSpeed + if newScale > scaleMax then + scaleToBigger = false + end else - scale = 1 + newScale = EID.Scale - scaleSpeed + if newScale < scaleMin then + scaleToBigger = true + end end - - EID.Config[scaleConfigName] = scale - EID.Scale = scale + EID.Scale = newScale + EID.Config[scaleConfigName] = newScale + else + scaleHoldFrame = scaleHoldFrame + 1 end end + -- press ScaleKey + if Input.IsButtonTriggered(scaleKey, 0) then + EID.MCM_OptionChanged = true + scaleHoldFrame = 0 + local scale = EID.Scale + + -- switch between 1, 1.5 and 0.5 + if math.abs(scale - 1) < 0.01 then + scale = 1.5 + elseif math.abs(scale - 1.5) < 0.01 then + scale = 0.5 + else + scale = 1 + end + + EID.Config[scaleConfigName] = scale + EID.Scale = scale + end end --------------------------------------------------------------------------- @@ -944,17 +942,20 @@ local function onRender(t) EID.OptionChanged = EID.MCM_OptionChanged EID.MCM_OptionChanged = false EID:resumeCoroutines() - handleScaleKey() + + -- Do not check our hotkeys while MCM is open, or they will be triggered while rebinding + if not ModConfigMenu or not ModConfigMenu.IsVisible then + handleScaleKey() + if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then + EID.isHidden = not EID.isHidden + end + end EID.isDisplaying = false EID:setPlayer() EID:PositionLocalMode() -- default to non-local mode to fix MCM / Bag errors EID.TabPreviewID = 0 - if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then - EID.isHidden = not EID.isHidden - end - if ModConfigMenu and ModConfigMenu.IsVisible and ModConfigMenu.Config["Mod Config Menu"].HideHudInMenu and EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" and EID.MCMCompat_isDisplayingEIDTab ~= "Crafting" then --if the mod config menu exists, is opened and Hide Hud is enabled, and ModConfigMenu isn't currently in the "Visuals" or "Crafting" tab of EID return end From 20d69c086c5f87373c7a2ae227867fe83fadd4f0 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:40:13 -0500 Subject: [PATCH 14/21] Shorten info text to fit in line --- mod_config_menu.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_config_menu.lua b/mod_config_menu.lua index 3b2b14a7..93d98713 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -460,7 +460,7 @@ if MCMLoaded then -- Display Mode local displayModes = {"default", "local"} EID:AddNumberSetting("Visuals", "DisplayMode", "Display Mode", 1, #displayModes, {indexOf = displayModes, - infoText = {"Changes display mode of descriptions", "Default: Text is displayed in the top left.", "Local: Text is displayed under the described object."}}) + infoText = {"Changes display mode of descriptions", "Default: Text is displayed in the top left", "Local: Text is displayed under the described object"}}) -- Scale/Size EID:AddNumberSetting("Visuals", "Size", "Text Size", 0.5, 2, {modifyBy = 0.25, onChangeFunc = From f2cc6fcae998cbc16579d1758255d9e07a3d2fed Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 19:42:49 -0500 Subject: [PATCH 15/21] Rename achievement warning --- main.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/main.lua b/main.lua index fca3ec33..5a30bb1e 100644 --- a/main.lua +++ b/main.lua @@ -884,9 +884,9 @@ local function attemptPathfind(entity) return success end -local hasShownAchievementWarning = false +local hasShownStartWarning = false local function renderAchievementInfo() - if REPENTANCE and not EID.Config.DisableAchievementCheck and game:GetFrameCount() < 10*30 then + if REPENTANCE and not EID.Config["DisableStartOfRunWarnings"] and game:GetFrameCount() < 10*30 then -- Old Repentance version check; update this to check for the existence of the newest mod API function EID uses -- 1.7.6 (Nov. 16, 2021): The Options object (to read the game's options like HUD Offset) if Options == nil then @@ -894,7 +894,7 @@ local function renderAchievementInfo() demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" demoDescObj.Description = EID:getDescriptionEntry("OldGameVersionWarningText") or "" EID:displayPermanentText(demoDescObj, "AchievementWarningTitle") - hasShownAchievementWarning = true + hasShownStartWarning = true -- Bag of Crafting modded items check elseif EID.player:HasCollectible(710) and EID:DetectModdedItems() and EID.Config.DisplayBagOfCrafting ~= "never" and (EID.Config.BagOfCraftingDisplayMode == "Recipe List" or EID.Config.BagOfCraftingDisplayMode == "Preview Only") then @@ -902,7 +902,7 @@ local function renderAchievementInfo() demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" demoDescObj.Description = EID:getDescriptionEntry("ModdedRecipesWarningText") or "" EID:displayPermanentText(demoDescObj, "AchievementWarningTitle") - hasShownAchievementWarning = true + hasShownStartWarning = true -- Achievements Locked Check (do we have Cube of Meat or Book of Revelations unlocked?) else local characterID = EID.player:GetPlayerType() @@ -917,12 +917,12 @@ local function renderAchievementInfo() demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" demoDescObj.Description = EID:getDescriptionEntry("AchievementWarningText") or "" EID:displayPermanentText(demoDescObj, "AchievementWarningTitle") - hasShownAchievementWarning = true + hasShownStartWarning = true end end end end - elseif hasShownAchievementWarning then + elseif hasShownStartWarning then EID:hidePermanentText() end end @@ -943,16 +943,16 @@ local function onRender(t) EID.MCM_OptionChanged = false EID:resumeCoroutines() + EID.isDisplaying = false + EID:setPlayer() -- Do not check our hotkeys while MCM is open, or they will be triggered while rebinding if not ModConfigMenu or not ModConfigMenu.IsVisible then + -- scale key must be handled before resetting to non-local mode handleScaleKey() if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then EID.isHidden = not EID.isHidden end end - - EID.isDisplaying = false - EID:setPlayer() EID:PositionLocalMode() -- default to non-local mode to fix MCM / Bag errors EID.TabPreviewID = 0 From 730701e5eb69bf4fd3eba6e38c81545842c281ed Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 5 Feb 2022 20:04:00 -0500 Subject: [PATCH 16/21] allow our hotkeys outside of the menus they're set --- main.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.lua b/main.lua index 5a30bb1e..e83787c2 100644 --- a/main.lua +++ b/main.lua @@ -885,7 +885,7 @@ local function attemptPathfind(entity) end local hasShownStartWarning = false -local function renderAchievementInfo() +local function checkStartOfRunWarnings() if REPENTANCE and not EID.Config["DisableStartOfRunWarnings"] and game:GetFrameCount() < 10*30 then -- Old Repentance version check; update this to check for the existence of the newest mod API function EID uses -- 1.7.6 (Nov. 16, 2021): The Options object (to read the game's options like HUD Offset) @@ -896,7 +896,7 @@ local function renderAchievementInfo() EID:displayPermanentText(demoDescObj, "AchievementWarningTitle") hasShownStartWarning = true -- Bag of Crafting modded items check - elseif EID.player:HasCollectible(710) and EID:DetectModdedItems() and EID.Config.DisplayBagOfCrafting ~= "never" and + elseif EID:PlayersHaveCollectible(710) and EID:DetectModdedItems() and EID.Config.DisplayBagOfCrafting ~= "never" and (EID.Config.BagOfCraftingDisplayMode == "Recipe List" or EID.Config.BagOfCraftingDisplayMode == "Preview Only") then local demoDescObj = EID:getDescriptionObj(-999, -1, 1) demoDescObj.Name = EID:getDescriptionEntry("AchievementWarningTitle") or "" @@ -945,8 +945,8 @@ local function onRender(t) EID.isDisplaying = false EID:setPlayer() - -- Do not check our hotkeys while MCM is open, or they will be triggered while rebinding - if not ModConfigMenu or not ModConfigMenu.IsVisible then + -- Do not check our hotkeys while a tab that can modify the hotkey is open + if EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" then -- scale key must be handled before resetting to non-local mode handleScaleKey() if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then @@ -956,11 +956,12 @@ local function onRender(t) EID:PositionLocalMode() -- default to non-local mode to fix MCM / Bag errors EID.TabPreviewID = 0 - if ModConfigMenu and ModConfigMenu.IsVisible and ModConfigMenu.Config["Mod Config Menu"].HideHudInMenu and EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" and EID.MCMCompat_isDisplayingEIDTab ~= "Crafting" then --if the mod config menu exists, is opened and Hide Hud is enabled, and ModConfigMenu isn't currently in the "Visuals" or "Crafting" tab of EID + -- If MCM is open, don't show anything unless we're in a tab labeled as "Visuals" or "Crafting" + if ModConfigMenu and ModConfigMenu.IsVisible and ModConfigMenu.Config["Mod Config Menu"].HideHudInMenu and EID.MCMCompat_isDisplayingEIDTab ~= "Visuals" and EID.MCMCompat_isDisplayingEIDTab ~= "Crafting" then return end - renderAchievementInfo() + checkStartOfRunWarnings() EID:renderMCMDummyDescription() if EID.GameVersion == "ab+" then From 28e723d9bec3fa48bab96bd6fa11ede4e7d8b768 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sun, 6 Feb 2022 00:15:31 -0500 Subject: [PATCH 17/21] Move descs down if 18 heart max --- main.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.lua b/main.lua index e83787c2..bf7ebc2d 100644 --- a/main.lua +++ b/main.lua @@ -971,11 +971,18 @@ local function onRender(t) EID:removeTextPosModifier("Schoolbag") end else - if EID.player.SubType == 21 or EID.player.SubType == 25 then -- T-Isaac, T-Blue Baby + -- Tainted Isaac and Tainted ??? + if EID.player.SubType == 21 or EID.player.SubType == 25 then EID:addTextPosModifier("Tained HUD", Vector(0,30)) else EID:removeTextPosModifier("Tained HUD") end + -- Magdalene Birthright + if EID.player.SubType == 1 and EID.player:HasCollectible(619) then + EID:addTextPosModifier("18 Heart HUD", Vector(0,5)) + else + EID:removeTextPosModifier("18 Heart HUD") + end end if EID.isHidden then From 5345453b7c62ad77d0df28e47ef600e1f54fbb35 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sun, 6 Feb 2022 00:21:59 -0500 Subject: [PATCH 18/21] fix Local Mode having modifiers applied --- main.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.lua b/main.lua index bf7ebc2d..8df9e104 100644 --- a/main.lua +++ b/main.lua @@ -384,7 +384,7 @@ local scaleMin = 0.1 local scaleMax = 2 local scaleSpeed = 0.01 -- scale size per frame local scaleToBigger = true -local scaleConfigName = "Size" +EID.CurrentScaleType = "Size" -- Size or LocalModeSize; checked by EID:getTextPosition() to not apply modifiers in local mode local scaleHoldFrame = 0 local function handleScaleKey() local scaleKey = EID.Config["SizeHotkey"] @@ -406,7 +406,7 @@ local function handleScaleKey() end end EID.Scale = newScale - EID.Config[scaleConfigName] = newScale + EID.Config[EID.CurrentScaleType] = newScale else scaleHoldFrame = scaleHoldFrame + 1 end @@ -426,7 +426,7 @@ local function handleScaleKey() scale = 1 end - EID.Config[scaleConfigName] = scale + EID.Config[EID.CurrentScaleType] = scale EID.Scale = scale end end @@ -736,7 +736,7 @@ function EID:PositionLocalMode(entity) -- don't use Local Mode for descriptions without an entity (or dice floors) if EID.Config["DisplayMode"] == "local" and entity and entity.Variant ~= EffectVariant.DICE_FLOOR then EID.Scale = EID.Config["LocalModeSize"] - scaleConfigName = "LocalModeSize" + EID.CurrentScaleType = "LocalModeSize" local textBoxWidth = EID.Config["LocalModeCentered"] and tonumber(EID.Config["TextboxWidth"])/2 * EID.Scale or -30 local textPosOffset = Vector(-textBoxWidth, 20) EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset)) @@ -750,7 +750,7 @@ function EID:PositionLocalMode(entity) end else EID.Scale = EID.Config["Size"] - scaleConfigName = "Size" + EID.CurrentScaleType = "Size" EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) end end From 42c12b9cb1b74a1e606531152965f025119deeee Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sun, 6 Feb 2022 00:22:28 -0500 Subject: [PATCH 19/21] fix Local Mode having modifiers applied --- eid_api.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eid_api.lua b/eid_api.lua index d97f9624..724ea6e9 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -265,8 +265,11 @@ end -- returns the current text position function EID:getTextPosition() local posVector = Vector(EID.UsedPosition.X, EID.UsedPosition.Y) - for _, modifier in pairs(EID.PositionModifiers) do - posVector = posVector + modifier + -- Only apply position modifiers when not in Local Mode + if EID.CurrentScaleType == "Size" then + for _, modifier in pairs(EID.PositionModifiers) do + posVector = posVector + modifier + end end return posVector end From 23a4ca4a352051f3acdfdc67426d5b32160980bc Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sun, 6 Feb 2022 02:51:19 -0500 Subject: [PATCH 20/21] fix anti-gravity / eve's mascara --- descriptions/rep/en_us.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index a24d1062..0b0470f2 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -88,7 +88,7 @@ local repCollectibles={ [211] = {"211", "Spiderbaby", "Spawn 3-5 Blue Spiders upon taking damage"}, -- Spiderbaby [214] = {"214", "Anemic", "↑ +1.5 Range up#Leave a trail of damaging creep upon taking damage"}, -- Anemic [218] = {"218", "Placenta", "↑ +1 Health up#Heals 1 Red Heart#Chance to heal half a heart every minute"}, -- Placenta - [222] = {"222", "Anti-Gravity", "Holding the fire buttons causes tears to hover in midair#When released, they will all shoot in the direction they were fired#↑ +2 Fire Rate up"}, -- Anti-Gravity + [222] = {"222", "Anti-Gravity", "Holding the fire buttons causes tears to hover in midair#When released, they will all shoot in the direction they were fired#↑ +1 Fire Rate up"}, -- Anti-Gravity [224] = {"224", "Cricket's Body", "Tears split in 4 on hit#Split tears deal half your damage#↑ +0.5 Fire Rate up#↓ -20% Range down"}, -- Cricket's Body [228] = {"228", "Mom's Perfume", "15% chance to shoot Fear tears#↑ +0.5 Fire Rate up"}, -- Mom's Perfume [230] = {"230", "Abaddon", "↑ +1.5 Damage up#↑ +0.2 Speed up#Fear tears#Converts all Red Heart Containers into Black Hearts#+2 Black Hearts"}, -- Abaddon @@ -125,7 +125,7 @@ local repCollectibles={ [307] = {"307", "Capricorn", "↑ +1 Health up#↑ +0.5 Damage up#↑ +0.1 Speed up#↑ +0.75 Range up#↑ +0.5 Fire Rate up#Gives one bomb, coin and key"}, -- Capricorn [308] = {"308", "Aquarius", "Leave a trail of creep#Creep deals 66% your damage per second#Creep synergizes with tear effects"}, -- Aquarius [309] = {"309", "Pisces", "↑ +0.5 Fire Rate up#Increases tear knockback"}, - [310] = {"310", "Eve's Mascara", "↑ 200% Damage up#↓ -33% Tears down#↓ -0.5 Shot Speed down"}, + [310] = {"310", "Eve's Mascara", "↑ +100% Damage up#↓ -33% Tears down#↓ -0.5 Shot Speed down"}, [314] = {"314", "Thunder Thighs", "↑ +1 Health up#↓ -0.4 Speed down#Heals 1 Red Heart#Destroy rocks when walking over them"}, -- Thunder Thighs [315] = {"315", "Strange Attractor", "Magnetic tears#Affects enemies, pickups and trinkets#Items will be attracted to where the tear lands"}, -- Strange Attractor [320] = {"320", "???'s Only Friend", "Controllable Fly#Deals 3.5 contact damage per tick"}, -- ???'s Only Friend From f13cbfe0b539f6b9b12c9de324b992fc3dd7f165 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sun, 6 Feb 2022 03:49:26 -0500 Subject: [PATCH 21/21] Fix Mouse pos not being doubled --- main.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index 8df9e104..d5b43f5f 100644 --- a/main.lua +++ b/main.lua @@ -783,7 +783,7 @@ local lastMousePos = Vector(0,0) local lastMouseMove = 0 function EID:handleHoverHUD() - local mousePos = Isaac.WorldToScreen(Input.GetMousePosition(true)) + local mousePos = Isaac.WorldToScreen(Input.GetMousePosition(true)) * 2 if mousePos:Distance(lastMousePos) > 2 then lastMousePos = mousePos lastMouseMove = game:GetFrameCount() @@ -792,12 +792,13 @@ function EID:handleHoverHUD() return nil end if EID.Config["ShowCursor"] then - EID.CursorSprite:Render(Vector(mousePos.X, mousePos.Y), nullVector, nullVector) + EID.CursorSprite:Render(Vector(mousePos.X / 2, mousePos.Y / 2), nullVector, nullVector) end for k, v in pairs(EID.HUDElements) do local hudElement = EID:handleHUDElement(v) if hudElement.x <= mousePos.X and (hudElement.x + hudElement.width) >= mousePos.X and hudElement.y <= mousePos.Y and (hudElement.y + hudElement.height) >= mousePos.Y then - return hudElement.descriptionObj() or nil + local result = hudElement.descriptionObj() + if result then return result end end end return nil