Reworked textures for HealthPanel

This commit is contained in:
ZioPao
2023-11-17 02:29:33 +01:00
parent 3418378139
commit 18dc61f552
18 changed files with 37 additions and 27 deletions

View File

@@ -221,7 +221,7 @@ function PlayerHandler.UpdateCicatrization()
TOC_DEBUG.print("updating cicatrization for " .. tostring(limbName))
if cicTime > 0 then
cicTime = cicTime - 60 -- 1 per minute, each cicatrizationTime is divisible by 60
cicTime = cicTime - 1
modDataHandler:setCicatrizationTime(limbName, cicTime)
TOC_DEBUG.print("new cicatrization time: " .. tostring(cicTime))
if cicTime < 0 then

View File

@@ -44,7 +44,7 @@ function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y)
end
--* Modifications to handle visible amputation on the health menu *--
--* Modifications and additional methods to handle visible amputation on the health menu *--
local og_ISHealthPanel_initialise = ISHealthPanel.initialise
function ISHealthPanel:initialise()
@@ -70,27 +70,37 @@ function ISHealthPanel:setOtherPlayer(playerObj)
--CachedDataHandler.CalculateAmputatedLimbs(self.character:getUsername())
end
---Get a value between 1 and 0.1 for the cicatrization time
---@param cicTime integer
---@return integer
local function GetScaledCicatrizationTime(cicTime)
return math.max(math.min(cicTime/100, 1), 0.1)
end
---Try to draw the highest amputation in the health panel, based on the cicatrization time
---@param side string L or R
---@param username string
function ISHealthPanel:tryDrawHighestAmputation(side, username)
if self.highestAmputations[side] == nil then return end
local cicTime = ModDataHandler.GetInstance(username):getCicatrizationTime(self.highestAmputations[side])
local scaledCicTIme = GetScaledCicatrizationTime(cicTime)
local texture = StaticData.HEALTH_PANEL_TEXTURES[self.sexPl][self.highestAmputations[side]]
self:drawTexture(texture, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 1, scaledCicTIme, 1, 1)
end
local og_ISHealthPanel_render = ISHealthPanel.render
function ISHealthPanel:render()
og_ISHealthPanel_render(self)
local username = self.character:getUsername()
--CachedDataHandler.CalculateHighestAmputatedLimbs(username)
self.highestAmputations = CachedDataHandler.GetHighestAmputatedLimbs(username)
if self.highestAmputations ~= nil then
-- Left Texture
if self.highestAmputations["L"] then
local textureL = StaticData.HEALTH_PANEL_TEXTURES[self.sexPl][self.highestAmputations["L"]]
self:drawTexture(textureL, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 1, 1, 0, 0)
end
self:tryDrawHighestAmputation("L", username)
-- Right Texture
if self.highestAmputations["R"] then
local textureR = StaticData.HEALTH_PANEL_TEXTURES[self.sexPl][self.highestAmputations["R"]]
self:drawTexture(textureR, self.healthPanel.x/2 + 2, self.healthPanel.y/2, 1, 1, 0, 0)
end
self:tryDrawHighestAmputation("R", username)
else
-- Request caching data
TOC_DEBUG.print("highest amputated limbs was nil, calculating and getting it now for" .. username)

View File

@@ -64,7 +64,7 @@ StaticData.BODYLOCS_IND_BPT = {}
---@param side string
local function AssembleHandData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 60
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 1200
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 120
StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[assembledName] = 2
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = {}
StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = StaticData.PARTS_IND_STR.ForeArm .. "_" .. side
@@ -74,7 +74,7 @@ end
---@param side string
local function AssembleForearmData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 80
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 1800
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 144
StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[assembledName] = 3
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = { StaticData.PARTS_IND_STR.Hand .. "_" .. side }
StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = StaticData.PARTS_IND_STR.UpperArm .. "_" .. side
@@ -84,7 +84,7 @@ end
---@param side string
local function AssembleUpperarmData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 100
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 1800
StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[assembledName] = 192
StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[assembledName] = 4
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = { StaticData.PARTS_IND_STR.Hand .. "_" .. side,
StaticData.PARTS_IND_STR.ForeArm .. "_" .. side }
@@ -178,23 +178,23 @@ StaticData.TRAITS_BP = {
StaticData.HEALTH_PANEL_TEXTURES = {
Female = {
Hand_L = getTexture("media/ui/Hand_L.png"),
ForeArm_L = getTexture("media/ui/ForeArm_L.png"),
UpperArm_L = getTexture("media/ui/UpperArm_L.png"),
Hand_L = getTexture("media/ui/Female/Hand_L.png"),
ForeArm_L = getTexture("media/ui/Female/ForeArm_L.png"),
UpperArm_L = getTexture("media/ui/Female/UpperArm_L.png"),
Hand_R = getTexture("media/ui/Hand_R.png"),
ForeArm_R = getTexture("media/ui/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/UpperArm_R.png")
Hand_R = getTexture("media/ui/Female/Hand_R.png"),
ForeArm_R = getTexture("media/ui/Female/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/Female/UpperArm_R.png")
},
Male = {
Hand_L = getTexture("media/ui/Hand_L.png"),
ForeArm_L = getTexture("media/ui/ForeArm_L.png"),
UpperArm_L = getTexture("media/ui/UpperArm_L.png"),
Hand_L = getTexture("media/ui/Male/Hand_L.png"),
ForeArm_L = getTexture("media/ui/Male/ForeArm_L.png"),
UpperArm_L = getTexture("media/ui/Male/UpperArm_L.png"),
Hand_R = getTexture("media/ui/Hand_R.png"),
ForeArm_R = getTexture("media/ui/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/UpperArm_R.png")
Hand_R = getTexture("media/ui/Male/Hand_R.png"),
ForeArm_R = getTexture("media/ui/Male/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/Male/UpperArm_R.png")
}
}