Fixed Local mode issues and added right alligned text mode for local mode

This commit is contained in:
Wofsauge committed 2021-12-04 22:12:13 +01:00
1 parent b5e0736479
commit 881c2cfd7b
3 files changed
+67 -43

No files matched your search

+17 -7
View File
@@ -59,12 +59,6 @@ EID.UserConfig = {
-- Set Y Position (Height) of the descriptiontext -- Set Y Position (Height) of the descriptiontext
-- Default = 45 -- Default = 45
["YPosition"] = 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) -- Set the distance to an item in which informations will be displayed (in Tiles)
-- Default = 5 -- Default = 5
["MaxDistance"] = 5, ["MaxDistance"] = 5,
@@ -96,6 +90,21 @@ EID.UserConfig = {
-- Default = false -- Default = false
["DisableAchievementCheck"] = 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------------- -------------CURSE-------------
-- Disable informations when the floor has curse of the blind ( ? - Items) -- Disable informations when the floor has curse of the blind ( ? - Items)
@@ -312,8 +321,9 @@ EID.DefaultConfig = {
["HUDOffset"] = 10, ["HUDOffset"] = 10,
["XPosition"] = 60, ["XPosition"] = 60,
["YPosition"] = 45, ["YPosition"] = 45,
["LocalMode"] = true, ["DisplayMode"] = "default",
["LocalScale"] = 0.5, ["LocalScale"] = 0.5,
["LocalModeCentered"] = true,
["MaxDistance"] = 5, ["MaxDistance"] = 5,
["Indicator"] = "none", ["Indicator"] = "none",
["HideKey"] = Keyboard.KEY_F2, ["HideKey"] = Keyboard.KEY_F2,
+8 -6
View File
@@ -9,7 +9,7 @@ local game = Game()
require("eid_config") require("eid_config")
EID.Config = EID.UserConfig EID.Config = EID.UserConfig
EID.Config.Version = "3.3" EID.Config.Version = "3.3"
EID.ModVersion = "4.0" EID.ModVersion = "3.100"
EID.DefaultConfig.Version = EID.Config.Version EID.DefaultConfig.Version = EID.Config.Version
EID.isHidden = false EID.isHidden = false
EID.player = nil EID.player = nil
@@ -441,23 +441,25 @@ function EID:ScaleValue(entity)
if entity.Variant == EffectVariant.DICE_FLOOR then if entity.Variant == EffectVariant.DICE_FLOOR then
EID.Scale = EID.Config["Scale"] EID.Scale = EID.Config["Scale"]
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) 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"] EID.Scale = EID.Config["LocalScale"]
end end
end end
function EID:PositionLocalMode(entity) function EID:PositionLocalMode(entity)
if EID.Config["LocalMode"] then if EID.Config["DisplayMode"] == "local" then
EID:alterTextPos(Isaac.WorldToScreen(entity.Position - Vector(35,-20))) 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 REPENTANCE then
if isMirrorRoom 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 local screenCenter = EID:getScreenSize()/2
EID.UsedPosition.X = EID.UsedPosition.X - (EID.UsedPosition-screenCenter).X * 2 EID.UsedPosition.X = EID.UsedPosition.X - (EID.UsedPosition-screenCenter).X * 2
end end
end end
if entity:ToPickup() and entity:ToPickup():IsShopItem() then 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 end
else else
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
+42 -30
View File
@@ -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( MCM.AddSetting(
"EID", "EID",
"Visuals", "Visuals",
{ {
Type = ModConfigMenu.OptionType.BOOLEAN, Type = ModConfigMenu.OptionType.NUMBER,
CurrentSetting = function() CurrentSetting = function()
return EID.Config["LocalMode"] return AnIndexOf(displayModes, EID.Config["DisplayMode"])
end, end,
Minimum = 1,
Maximum = #displayModes,
Display = function() Display = function()
local onOff = "False" return "Display mode: " .. EID.Config["DisplayMode"]
if EID.Config["LocalMode"] then
onOff = "True"
end
return "Local Mode: " .. onOff
end, end,
OnChange = function(currentBool) OnChange = function(currentNum)
EID.Config["LocalMode"] = currentBool EID.Config["DisplayMode"] = displayModes[currentNum]
end, 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 -- SCALE
local textScales = {0.5, 0.75, 1, 1.25, 1.5, 2} local textScales = {0.5, 0.75, 1, 1.25, 1.5, 2}
MCM.AddSetting( MCM.AddSetting(
@@ -899,46 +903,54 @@ if MCMLoaded then
{ {
Type = ModConfigMenu.OptionType.NUMBER, Type = ModConfigMenu.OptionType.NUMBER,
CurrentSetting = function() 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, end,
Minimum = 1, Minimum = 1,
Maximum = 6, Maximum = 6,
Display = function() Display = function()
if EID.Config["LocalMode"] then if EID.Config["DisplayMode"] == "local" then
return "Text Size (Pickup Description): " .. EID.Config["LocalScale"] return "Text Size (Local mode): " .. EID.Config["LocalScale"]
else else
return "Text Size (All Description): " .. EID.Config["Scale"] return "Text Size: " .. EID.Config["Scale"]
end
end, end,
OnChange = function(currentNum) 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, end,
Info = {"Change text size. CAN BE HARD TO READ IN SOME SETTINGS!"} 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( MCM.AddSetting(
"EID", "EID",
"Visuals", "Visuals",
{ {
Type = ModConfigMenu.OptionType.NUMBER, Type = ModConfigMenu.OptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return AnIndexOf(textScales, EID.Config["Scale"]) return EID.Config["LocalModeCentered"]
end, end,
Minimum = 1,
Maximum = 6,
Display = function() Display = function()
if EID.Config["LocalMode"] then local onOff = "False"
return "Text Size (Room Description): " .. EID.Config["Scale"] if EID.Config["LocalModeCentered"] then
else onOff = "True"
return ""
end end
return "Local mode centered: " .. onOff
end, end,
OnChange = function(currentNum) OnChange = function(currentBool)
EID.Config["Scale"] = textScales[currentNum] EID.Config["LocalModeCentered"] = currentBool
end, end
Info = {"Change text size. CAN BE HARD TO READ IN SOME SETTINGS!"}
} }
) )
-- Transparency -- Transparency
local transparencies = {0.1, 0.175, 0.25, 0.3, 0.4, 0.5, 0.6, 0.75, 0.8, 0.9, 1} 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( MCM.AddSetting(