diff --git a/eid_config.lua b/eid_config.lua index 07108dc2..d8bac318 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -59,12 +59,6 @@ EID.UserConfig = { -- Set Y Position (Height) of the descriptiontext -- Default = 45 ["YPosition"] = 45, - -- Sets the local rendering mode of the description text below currently inspected object - -- Default = false - ["LocalMode"] = false, - -- Change Size of the info boxes for LocalMode. Range: [0,...,1] - -- Default = 0.5 - ["LocalScale"] = 0.5, -- Set the distance to an item in which informations will be displayed (in Tiles) -- Default = 5 ["MaxDistance"] = 5, @@ -96,6 +90,21 @@ EID.UserConfig = { -- Default = false ["DisableAchievementCheck"] = false, + -------Display Modes--------- + + -- Sets the display mode of the description text. + -- possible values: default, local + -- "default": text will be displayed in the top-left of the screen. + -- "local": text will be displayed under the described object. + -- Default = "default" + ["DisplayMode"] = "default", + -- Change Size of the info boxes for LocalMode. + -- Default = 0.5 + ["LocalScale"] = 0.5, + -- Changes the position of the text in local mode, relative to the described object to be centered. Set to false to make it left-aligned + -- Default = true + ["LocalModeCentered"] = true, + -------------CURSE------------- -- Disable informations when the floor has curse of the blind ( ? - Items) @@ -312,8 +321,9 @@ EID.DefaultConfig = { ["HUDOffset"] = 10, ["XPosition"] = 60, ["YPosition"] = 45, - ["LocalMode"] = true, + ["DisplayMode"] = "default", ["LocalScale"] = 0.5, + ["LocalModeCentered"] = true, ["MaxDistance"] = 5, ["Indicator"] = "none", ["HideKey"] = Keyboard.KEY_F2, diff --git a/main.lua b/main.lua index 593479eb..cbdbe4a6 100644 --- a/main.lua +++ b/main.lua @@ -9,7 +9,7 @@ local game = Game() require("eid_config") EID.Config = EID.UserConfig EID.Config.Version = "3.3" -EID.ModVersion = "4.0" +EID.ModVersion = "3.100" EID.DefaultConfig.Version = EID.Config.Version EID.isHidden = false EID.player = nil @@ -441,23 +441,25 @@ function EID:ScaleValue(entity) if entity.Variant == EffectVariant.DICE_FLOOR then EID.Scale = EID.Config["Scale"] EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) - elseif EID.Config["LocalMode"] then + elseif EID.Config["DisplayMode"] == "local" then EID.Scale = EID.Config["LocalScale"] end end function EID:PositionLocalMode(entity) - if EID.Config["LocalMode"] then - EID:alterTextPos(Isaac.WorldToScreen(entity.Position - Vector(35,-20))) + if EID.Config["DisplayMode"] == "local" then + 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 - Vector(-35,-20))) + 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 end if entity:ToPickup() and entity:ToPickup():IsShopItem() then - EID:alterTextPos(Isaac.WorldToScreen(entity.Position - Vector(35,-40))) + EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset)) end else EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) diff --git a/mod_config_menu.lua b/mod_config_menu.lua index 5d288d94..81cda46f 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -870,27 +870,31 @@ if MCMLoaded then } ) - -- LOCAL MODE + -- Display Mode + 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.BOOLEAN, + Type = ModConfigMenu.OptionType.NUMBER, CurrentSetting = function() - return EID.Config["LocalMode"] + return AnIndexOf(displayModes, EID.Config["DisplayMode"]) end, + Minimum = 1, + Maximum = #displayModes, Display = function() - local onOff = "False" - if EID.Config["LocalMode"] then - onOff = "True" - end - return "Local Mode: " .. onOff + return "Display mode: " .. EID.Config["DisplayMode"] end, - OnChange = function(currentBool) - EID.Config["LocalMode"] = currentBool + OnChange = function(currentNum) + EID.Config["DisplayMode"] = displayModes[currentNum] end, - Info = {"Sets the local rendering mode of the description text below currently inspected object"} + Info = function() + return {"Changes display mode of descriptions", displayModeTips[AnIndexOf(displayModes, EID.Config["DisplayMode"])]} + end } + ) + -- SCALE local textScales = {0.5, 0.75, 1, 1.25, 1.5, 2} MCM.AddSetting( @@ -899,46 +903,54 @@ if MCMLoaded then { Type = ModConfigMenu.OptionType.NUMBER, CurrentSetting = function() - return AnIndexOf(textScales, EID.Config["Scale"]) + if EID.Config["DisplayMode"] == "local" then + return AnIndexOf(textScales, EID.Config["LocalScale"]) + else + return AnIndexOf(textScales, EID.Config["Scale"]) + end end, Minimum = 1, Maximum = 6, Display = function() - if EID.Config["LocalMode"] then - return "Text Size (Pickup Description): " .. EID.Config["LocalScale"] + if EID.Config["DisplayMode"] == "local" then + return "Text Size (Local mode): " .. EID.Config["LocalScale"] else - return "Text Size (All Description): " .. EID.Config["Scale"] + return "Text Size: " .. EID.Config["Scale"] + end end, OnChange = function(currentNum) - EID.Config["Scale"] = textScales[currentNum] + if EID.Config["DisplayMode"] == "local" then + EID.Config["LocalScale"] = textScales[currentNum] + else + EID.Config["Scale"] = textScales[currentNum] + end + EID.Scale = textScales[currentNum] end, Info = {"Change text size. CAN BE HARD TO READ IN SOME SETTINGS!"} } ) - local textScales = {0.5, 0.75, 1, 1.25, 1.5, 2} + -- Transparency MCM.AddSetting( "EID", "Visuals", { - Type = ModConfigMenu.OptionType.NUMBER, + Type = ModConfigMenu.OptionType.BOOLEAN, CurrentSetting = function() - return AnIndexOf(textScales, EID.Config["Scale"]) + return EID.Config["LocalModeCentered"] end, - Minimum = 1, - Maximum = 6, Display = function() - if EID.Config["LocalMode"] then - return "Text Size (Room Description): " .. EID.Config["Scale"] - else - return "" + local onOff = "False" + if EID.Config["LocalModeCentered"] then + onOff = "True" end + return "Local mode centered: " .. onOff end, - OnChange = function(currentNum) - EID.Config["Scale"] = textScales[currentNum] - end, - Info = {"Change text size. CAN BE HARD TO READ IN SOME SETTINGS!"} + OnChange = function(currentBool) + EID.Config["LocalModeCentered"] = currentBool + end } - ) + ) + -- 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(