Skip to content

Commit 4c2eefb

Browse files
committed
displayNodeOffsetY attribute now properly offsets Y position in world space
1 parent 6a74f91 commit 4c2eefb

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/ConfigurationUnit.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,18 @@ end
168168
---@return boolean isValid
169169
---@return number x
170170
---@return number y
171-
---@return number offsetY
172171
function ConfigurationUnit:getDisplayPosition()
173172
local node, offsetY = self:getDisplayNode()
174173

175174
if node ~= nil then
176175
local x, y, z = getWorldTranslation(node)
176+
y = y + offsetY
177177
local sx, sy, sz = project(x, y, z)
178178

179179
if sx > -1 and sx < 2 and sy > -1 and sy < 2 and sz <= 1 then
180-
return true, sx, sy, offsetY
180+
return true, sx, sy
181181
end
182182
end
183183

184-
return false, 0, 0, offsetY
184+
return false, 0, 0
185185
end

scripts/hud/HUDProcessorUnitDisplayElement.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ end
8787
---@param unit ConfigurationUnit
8888
---@param title string
8989
function HUDProcessorUnitDisplayElement:drawUnit(unit, title)
90-
local valid, x, y, offsetY = unit:getDisplayPosition()
90+
local valid, x, y = unit:getDisplayPosition()
9191

9292
if valid then
9393
x = x - self.elements.root.absSize[1] / 2
@@ -96,7 +96,7 @@ function HUDProcessorUnitDisplayElement:drawUnit(unit, title)
9696
self.elements.text:setText(unit.fillType.title)
9797
self.elements.image:setImageFilename(unit.fillType.hudOverlayFilename)
9898

99-
self.elements.root:setPosition(x, y + offsetY)
99+
self.elements.root:setPosition(x, y)
100100
self.elements.root:draw()
101101
end
102102
end

0 commit comments

Comments
 (0)