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

Binary file not shown.

Binary file not shown.

View File

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

View File

@@ -44,7 +44,7 @@ function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y)
end 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 local og_ISHealthPanel_initialise = ISHealthPanel.initialise
function ISHealthPanel:initialise() function ISHealthPanel:initialise()
@@ -70,27 +70,37 @@ function ISHealthPanel:setOtherPlayer(playerObj)
--CachedDataHandler.CalculateAmputatedLimbs(self.character:getUsername()) --CachedDataHandler.CalculateAmputatedLimbs(self.character:getUsername())
end 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 local og_ISHealthPanel_render = ISHealthPanel.render
function ISHealthPanel:render() function ISHealthPanel:render()
og_ISHealthPanel_render(self) og_ISHealthPanel_render(self)
local username = self.character:getUsername() local username = self.character:getUsername()
--CachedDataHandler.CalculateHighestAmputatedLimbs(username)
self.highestAmputations = CachedDataHandler.GetHighestAmputatedLimbs(username) self.highestAmputations = CachedDataHandler.GetHighestAmputatedLimbs(username)
if self.highestAmputations ~= nil then if self.highestAmputations ~= nil then
-- Left Texture -- Left Texture
if self.highestAmputations["L"] then self:tryDrawHighestAmputation("L", username)
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
-- Right Texture -- Right Texture
if self.highestAmputations["R"] then self:tryDrawHighestAmputation("R", username)
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
else else
-- Request caching data -- Request caching data
TOC_DEBUG.print("highest amputated limbs was nil, calculating and getting it now for" .. username) 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 ---@param side string
local function AssembleHandData(assembledName, side) local function AssembleHandData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 60 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_TIME_MULTIPLIER_IND_NUM[assembledName] = 2
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = {} StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = {}
StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = StaticData.PARTS_IND_STR.ForeArm .. "_" .. side StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = StaticData.PARTS_IND_STR.ForeArm .. "_" .. side
@@ -74,7 +74,7 @@ end
---@param side string ---@param side string
local function AssembleForearmData(assembledName, side) local function AssembleForearmData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 80 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_TIME_MULTIPLIER_IND_NUM[assembledName] = 3
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = { StaticData.PARTS_IND_STR.Hand .. "_" .. side } StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = { StaticData.PARTS_IND_STR.Hand .. "_" .. side }
StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = StaticData.PARTS_IND_STR.UpperArm .. "_" .. side StaticData.LIMBS_ADJACENT_IND_STR[assembledName] = StaticData.PARTS_IND_STR.UpperArm .. "_" .. side
@@ -84,7 +84,7 @@ end
---@param side string ---@param side string
local function AssembleUpperarmData(assembledName, side) local function AssembleUpperarmData(assembledName, side)
StaticData.LIMBS_BASE_DAMAGE_IND_NUM[assembledName] = 100 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_TIME_MULTIPLIER_IND_NUM[assembledName] = 4
StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = { StaticData.PARTS_IND_STR.Hand .. "_" .. side, StaticData.LIMBS_DEPENDENCIES_IND_STR[assembledName] = { StaticData.PARTS_IND_STR.Hand .. "_" .. side,
StaticData.PARTS_IND_STR.ForeArm .. "_" .. side } StaticData.PARTS_IND_STR.ForeArm .. "_" .. side }
@@ -178,23 +178,23 @@ StaticData.TRAITS_BP = {
StaticData.HEALTH_PANEL_TEXTURES = { StaticData.HEALTH_PANEL_TEXTURES = {
Female = { Female = {
Hand_L = getTexture("media/ui/Hand_L.png"), Hand_L = getTexture("media/ui/Female/Hand_L.png"),
ForeArm_L = getTexture("media/ui/ForeArm_L.png"), ForeArm_L = getTexture("media/ui/Female/ForeArm_L.png"),
UpperArm_L = getTexture("media/ui/UpperArm_L.png"), UpperArm_L = getTexture("media/ui/Female/UpperArm_L.png"),
Hand_R = getTexture("media/ui/Hand_R.png"), Hand_R = getTexture("media/ui/Female/Hand_R.png"),
ForeArm_R = getTexture("media/ui/ForeArm_R.png"), ForeArm_R = getTexture("media/ui/Female/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/UpperArm_R.png") UpperArm_R = getTexture("media/ui/Female/UpperArm_R.png")
}, },
Male = { Male = {
Hand_L = getTexture("media/ui/Hand_L.png"), Hand_L = getTexture("media/ui/Male/Hand_L.png"),
ForeArm_L = getTexture("media/ui/ForeArm_L.png"), ForeArm_L = getTexture("media/ui/Male/ForeArm_L.png"),
UpperArm_L = getTexture("media/ui/UpperArm_L.png"), UpperArm_L = getTexture("media/ui/Male/UpperArm_L.png"),
Hand_R = getTexture("media/ui/Hand_R.png"), Hand_R = getTexture("media/ui/Male/Hand_R.png"),
ForeArm_R = getTexture("media/ui/ForeArm_R.png"), ForeArm_R = getTexture("media/ui/Male/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/UpperArm_R.png") UpperArm_R = getTexture("media/ui/Male/UpperArm_R.png")
} }
} }

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
media/ui/Male/ForeArm_L.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

BIN
media/ui/Male/ForeArm_R.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
media/ui/Male/Hand_L.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
media/ui/Male/Hand_R.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
media/ui/male_base_test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB