Visible prost in HealthPanel

This commit is contained in:
ZioPao
2024-03-21 12:26:48 +01:00
parent ec44e4a29e
commit 0e911ec860
6 changed files with 24 additions and 5 deletions

View File

@@ -62,7 +62,6 @@ function ItemsController.Player.DeleteOldAmputationItem(playerObj, limbName)
local othLimbName = partName .. "_" .. side local othLimbName = partName .. "_" .. side
local othClothingItemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. othLimbName local othClothingItemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. othLimbName
-- TODO FindAndReturn could return an ArrayList. We need to check for that
local othClothingItem = playerObj:getInventory():FindAndReturn(othClothingItemName) local othClothingItem = playerObj:getInventory():FindAndReturn(othClothingItemName)

View File

@@ -80,7 +80,7 @@ end
---Try to draw the highest amputation in the health panel, based on the cicatrization time ---Try to draw the highest amputation in the health panel, based on the cicatrization time
---@param side string L or R ---@param side string L or R
---@param username string ---@param username string
function ISHealthPanel:tryDrawHighestAmputation(highestAmputations, side, username) function ISHealthPanel:tryDrawAmputation(highestAmputations, side, username)
local redColor local redColor
local texture local texture
@@ -101,6 +101,13 @@ function ISHealthPanel:tryDrawHighestAmputation(highestAmputations, side, userna
self:drawTexture(texture, self.healthPanel.x, self.healthPanel.y, 1, redColor, 0, 0) self:drawTexture(texture, self.healthPanel.x, self.healthPanel.y, 1, redColor, 0, 0)
end end
function ISHealthPanel:tryDrawProsthesis(highestAmputations, side, username)
local dc = DataController.GetInstance(username) -- TODO CACHE PROSTHESIS!!! Don't use DC here
local limbName = highestAmputations[side]
if limbName and dc:getIsProstEquipped(limbName) then
self:drawTexture(StaticData.HEALTH_PANEL_TEXTURES.ProstArm[side], self.healthPanel.x, self.healthPanel.y, 1, 1, 1, 1)
end
end
local og_ISHealthPanel_render = ISHealthPanel.render local og_ISHealthPanel_render = ISHealthPanel.render
function ISHealthPanel:render() function ISHealthPanel:render()
@@ -109,12 +116,21 @@ function ISHealthPanel:render()
local highestAmputations = CachedDataHandler.GetHighestAmputatedLimbs(username) local highestAmputations = CachedDataHandler.GetHighestAmputatedLimbs(username)
if highestAmputations ~= nil then if highestAmputations ~= nil then
-- Left Texture -- Left Texture
self:tryDrawHighestAmputation(highestAmputations, "L", username) self:tryDrawAmputation(highestAmputations, "L", username)
self:tryDrawProsthesis(highestAmputations, "L", username)
-- Right Texture -- Right Texture
self:tryDrawHighestAmputation(highestAmputations, "R", username) self:tryDrawAmputation(highestAmputations, "R", username)
self:tryDrawProsthesis(highestAmputations, "R", username)
end end
end end
-- We need to override this to force the alpha to 1 -- We need to override this to force the alpha to 1

View File

@@ -104,7 +104,6 @@ Events.OnInitGlobalModData.Add(SetupZombiesModData)
local function ReapplyAmputation(zombie) local function ReapplyAmputation(zombie)
local pID = GetZombieID(zombie) local pID = GetZombieID(zombie)
-- TODO Remove already checked zombies
if localOnlyZombiesMD[pID] ~= nil then if localOnlyZombiesMD[pID] ~= nil then
-- check if zombie has amputation -- check if zombie has amputation
local zombiesAmpData = localOnlyZombiesMD[pID] local zombiesAmpData = localOnlyZombiesMD[pID]

View File

@@ -202,6 +202,11 @@ StaticData.HEALTH_PANEL_TEXTURES = {
Hand_R = getTexture("media/ui/Male/Hand_R.png"), Hand_R = getTexture("media/ui/Male/Hand_R.png"),
ForeArm_R = getTexture("media/ui/Male/ForeArm_R.png"), ForeArm_R = getTexture("media/ui/Male/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/Male/UpperArm_R.png") UpperArm_R = getTexture("media/ui/Male/UpperArm_R.png")
},
ProstArm = {
L = getTexture("media/ui/ProstArm_L.png"),
R = getTexture("media/ui/ProstArm_R.png")
} }
} }

BIN
media/ui/ProstArm_L.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
media/ui/ProstArm_R.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB