Base for working UI
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
local PlayerHandler = require("TOC_PlayerHandler")
|
||||
local StaticData = require("TOC_StaticData")
|
||||
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local CutLimbHandler = require("UI/TOC_CutLimbHandler")
|
||||
|
||||
@@ -35,18 +38,55 @@ end
|
||||
|
||||
-- TODO We need male variations
|
||||
|
||||
local handL = getTexture("media/ui/Hand_L.png")
|
||||
local forearmL = getTexture("media/ui/ForeArm_L.png")
|
||||
local upperarmL = getTexture("media/ui/UpperArm_L.png")
|
||||
|
||||
---@return {partL : string?, partR : string?}
|
||||
local function GetHighestAmputation()
|
||||
-- TODO Cache this instead of doing it here!
|
||||
|
||||
local tab = {}
|
||||
local prevDepSize = {}
|
||||
for i=1, #StaticData.LIMBS_STRINGS do
|
||||
local limbName = StaticData.LIMBS_STRINGS[i]
|
||||
local index
|
||||
if string.find(limbName, "_L") then index = "L" else index = "R" end
|
||||
if PlayerHandler.modDataHandler:getIsCut(limbName) then
|
||||
|
||||
if tab[index] ~= nil then
|
||||
local cDependencySize = #StaticData.LIMBS_DEPENDENCIES[limbName]
|
||||
if cDependencySize > prevDepSize[index] then
|
||||
tab[index] = limbName
|
||||
prevDepSize[index] = StaticData.LIMBS_DEPENDENCIES[limbName]
|
||||
end
|
||||
else
|
||||
tab[index] = limbName
|
||||
prevDepSize[index] = #StaticData.LIMBS_DEPENDENCIES[limbName]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
return tab
|
||||
end
|
||||
|
||||
|
||||
local og_ISHealthPanel_render = ISHealthPanel.render
|
||||
function ISHealthPanel:render()
|
||||
og_ISHealthPanel_render(self)
|
||||
|
||||
-- TODO Handle another player health panel
|
||||
|
||||
local highestAmputations = GetHighestAmputation()
|
||||
|
||||
-- Left Texture
|
||||
if highestAmputations["L"] then
|
||||
local textureL = StaticData.HEALTH_PANEL_TEXTURES[highestAmputations["L"]]
|
||||
self:drawTextureScaled(textureL, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 123, 302, 1, 1, 0, 0)
|
||||
end
|
||||
|
||||
if highestAmputations["R"] then
|
||||
|
||||
end
|
||||
|
||||
|
||||
--self:drawTextureScaled(forearmL, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 123, 302, 1, 1, 0, 0)
|
||||
|
||||
-- Right Texture
|
||||
|
||||
|
||||
Reference in New Issue
Block a user