Added feature to get descriptions of HUD elements
This commit is contained in:
1 parent
b0a12ea770
commit
4b1ebfc1c8
8 files changed
+266
-32
No files matched your search
+40
@@ -800,6 +800,46 @@ function EID:tableToCraftingIconsMerged(craftTable)
|
||||
end
|
||||
|
||||
|
||||
function EID:handleHUDElement(hudElement)
|
||||
local alteredHudElement = {}
|
||||
for k,v in pairs(hudElement) do
|
||||
alteredHudElement[k] = v
|
||||
end
|
||||
local screenSize = EID:GetScreenSize()
|
||||
for _,v in ipairs(hudElement.anchors) do
|
||||
if v == "TOP" then
|
||||
if EID.MCMLoaded then
|
||||
alteredHudElement.y = hudElement.y + EID.MCMHudOffset * 2
|
||||
end
|
||||
elseif v == "LEFT" then
|
||||
if EID.MCMLoaded then
|
||||
alteredHudElement.x = hudElement.x + EID.MCMHudOffset * 2
|
||||
end
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
return alteredHudElement
|
||||
end
|
||||
|
||||
function EID:GetScreenSize()
|
||||
local room = game:GetRoom()
|
||||
local pos = room:WorldToScreenPosition(Vector(0,0)) - room:GetRenderScrollOffset() - Game().ScreenShakeOffset
|
||||
|
||||
local rx = pos.X + 60 * 26 / 40
|
||||
local ry = pos.Y + 140 * (26 / 40)
|
||||
|
||||
return Vector(rx*2 + 13*26, ry*2 + 7*26)
|
||||
end
|
||||
|
||||
-- Creates a copy of a KColor object. This prevents overwriting existing
|
||||
function EID:copyKColor(colorObj)
|
||||
return KColor(colorObj.Red, colorObj.Green, colorObj.Blue, colorObj.Alpha)
|
||||
|
||||
Reference in new issue
Block a user