More tests and cleaning UI

This commit is contained in:
ZioPao
2023-11-07 01:37:00 +01:00
parent 4f6910c806
commit 01a6d34c97
4 changed files with 38 additions and 33 deletions

View File

@@ -36,33 +36,17 @@ end
--* Modification to handle visible amputation on the health menu *--
-- TODO We need male variations
function ISHealthPanel.GetHighestAmputation()
-- TODO Cache this instead of doing it here!
ISHealthPanel.highestAmputations = {}
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 ISHealthPanel.highestAmputations[index] ~= nil then
local cDependencySize = #StaticData.LIMBS_DEPENDENCIES[limbName]
if cDependencySize > prevDepSize[index] then
ISHealthPanel.highestAmputations[index] = limbName
prevDepSize[index] = StaticData.LIMBS_DEPENDENCIES[limbName]
end
else
ISHealthPanel.highestAmputations[index] = limbName
prevDepSize[index] = #StaticData.LIMBS_DEPENDENCIES[limbName]
end
if PlayerHandler.modDataHandler:getIsCut(limbName) and PlayerHandler.modDataHandler:getIsVisible(limbName) then
ISHealthPanel.highestAmputations[index] = limbName
end
end
end
@@ -77,22 +61,17 @@ function ISHealthPanel:render()
-- Left Texture
if ISHealthPanel.highestAmputations["L"] then
local textureL = StaticData.HEALTH_PANEL_TEXTURES[ISHealthPanel.highestAmputations["L"]]
self:drawTextureScaled(textureL, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 123, 302, 1, 1, 0, 0)
self:drawTexture(textureL, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 1, 1, 0, 0)
end
-- Right Texture
if ISHealthPanel.highestAmputations["R"] then
local textureR = StaticData.HEALTH_PANEL_TEXTURES[ISHealthPanel.highestAmputations["R"]]
self:drawTextureScaled(textureR, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 123, 302, 1, 1, 0, 0)
self:drawTexture(textureR, self.healthPanel.x/2 + 2, self.healthPanel.y/2, 1, 1, 0, 0)
end
else
ISHealthPanel.GetHighestAmputation()
end
end
-- We need to override this to force the alpha to 1