Added Hud Offset config option and fixed config changes made by MCM not being saved correctly

This commit is contained in:
Wofsauge committed 2021-06-20 17:24:33 +02:00
1 parent 5838e8f2e4
commit bc04732263
4 files changed
+19 -20

No files matched your search

+5 -12
View File
@@ -806,25 +806,18 @@ function EID:handleHUDElement(hudElement)
alteredHudElement[k] = v
end
local screenSize = EID:GetScreenSize()
local hudOffset = EID.Config["HUDOffset"]
for _,v in ipairs(hudElement.anchors) do
if v == "TOP" then
if EID.MCMLoaded then
alteredHudElement.y = hudElement.y + EID.MCMHudOffset * 2
end
alteredHudElement.y = hudElement.y + hudOffset * 2
elseif v == "LEFT" then
if EID.MCMLoaded then
alteredHudElement.x = hudElement.x + EID.MCMHudOffset * 2
end
alteredHudElement.x = hudElement.x + hudOffset * 2
elseif v == "BOTTOM" then
alteredHudElement.y = screenSize.Y*2 - alteredHudElement.y - alteredHudElement.height
if EID.MCMLoaded then
alteredHudElement.y = alteredHudElement.y - EID.MCMHudOffset * 2
end
alteredHudElement.y = alteredHudElement.y - hudOffset * 2
elseif v == "RIGHT" then
alteredHudElement.x = screenSize.X*2 - alteredHudElement.x - alteredHudElement.width
if EID.MCMLoaded then
alteredHudElement.x = alteredHudElement.x - EID.MCMHudOffset * 2
end
alteredHudElement.x = alteredHudElement.x - hudOffset * 2
end
end
return alteredHudElement
+8 -3
View File
@@ -30,11 +30,15 @@ EID.UserConfig = {
-- Set transparency of the background. Range: [0,...,1]
-- Default = 0.75
["Transparency"] = 0.75,
-- Set the HUD offset of the description.
-- This should be set to the same number of "strokes" set in the ingame options for the "hud offset" value. (Range is 0 to 10)
-- Default = 10
["HUDOffset"] = 10,
-- Set X Position (Width) of the descriptiontext
-- Default = 60 (with default rep Hud offset, otherwise 50 is recommended)
-- Default = 60
["XPosition"] = 60,
-- Set Y Position (Height) of the descriptiontext
-- Default = 45 (with default rep Hud offset, otherwise 35 is recommended)
-- Default = 45
["YPosition"] = 45,
-- Set the distance to an item in which informations will be displayed (in Tiles)
-- Default = 5
@@ -215,6 +219,7 @@ EID.DefaultConfig = {
["TextboxWidth"] = 100,
["Scale"] = 1,
["Transparency"] = 0.75,
["HUDOffset"] = 10,
["XPosition"] = 60,
["YPosition"] = 45,
["MaxDistance"] = 5,
@@ -249,7 +254,7 @@ EID.DefaultConfig = {
["DisplayBagOfCrafting"] = "always",
["BagOfCraftingResults"] = 7,
["SpindownDiceResults"] = 3,
["UseMouseControls"] = false,
["EnableMouseControls"] = false,
["ShowCursor"] = false,
["ErrorMessage"] = "[Effect not defined]",
["TextColor"] = "ColorEIDText",
+1
View File
@@ -740,6 +740,7 @@ if EID.MCMLoaded or REPENTANCE then
EID.isHidden = EID.Config["Hidden"]
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
EID:addTextPosModifier("HudOffset", Vector((EID.Config["HUDOffset"] * 2) - 20, EID.Config["HUDOffset"] - 10))
end
end
end
+5 -5
View File
@@ -6,7 +6,6 @@ local MCMCompat_isDisplayingDummyMCMObj = false
local MCMCompat_oldPermanentObj = false
EID.MCMLoaded = MCMLoaded
local colorNameArray = {}
EID.MCMHudOffset = 10
local function renderDummyDesc()
MCMCompat_oldPermanentObj = EID.permanentDisplayTextObj
@@ -29,11 +28,12 @@ end
function EID:renderMCMDummyDescription()
if MCMLoaded then
EID.MCMHudOffset = ModConfigMenu.Config["General"].HudOffset
if EID.MCMHudOffset == nil and ScreenHelper then
EID.MCMHudOffset = ScreenHelper.GetOffset()
local hudOffset = ModConfigMenu.Config["General"].HudOffset
if hudOffset == nil and ScreenHelper then
hudOffset = ScreenHelper.GetOffset()
end
EID:addTextPosModifier("MCM_HudOffset", Vector((EID.MCMHudOffset * 2) - 20, EID.MCMHudOffset - 10))
EID.Config["HUDOffset"] = hudOffset
EID:addTextPosModifier("HudOffset", Vector((hudOffset * 2) - 20, hudOffset - 10))
if MCM.IsVisible and EID.MCMCompat_isDisplayingEIDTab ~= "" then
if EID.MCMCompat_isDisplayingEIDTab == "Mouse" and EID.Config["EnableMouseControls"] then
clearRenderDummyDesc()