Bug fixes and better handling of ISHealthPanel

This commit is contained in:
ZioPao
2023-11-09 12:25:29 +01:00
parent 99ce9bacda
commit c8cd318f2d
3 changed files with 23 additions and 10 deletions

View File

@@ -50,9 +50,8 @@ function PlayerHandler.CheckInfection(character)
-- This fucking event barely works. Bleeding seems to be the only thing that triggers it
if character ~= getPlayer() then return end
local bd = character:getBodyDamage()
if bd == nil then return end -- Not sure why sometimes we get no BodyDamage, so just return this for now
for i=1, #StaticData.LIMBS_STRINGS do
local limbName = StaticData.LIMBS_STRINGS[i]
local bptEnum = StaticData.BODYPARTSTYPES_ENUM[limbName]

View File

@@ -60,13 +60,17 @@ end
--- Textures
-- TODO We need male variations
StaticData.HEALTH_PANEL_TEXTURES = {
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_R = getTexture("media/ui/Hand_R.png"),
ForeArm_R = getTexture("media/ui/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/UpperArm_R.png")
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_R = getTexture("media/ui/Hand_R.png"),
ForeArm_R = getTexture("media/ui/ForeArm_R.png"),
UpperArm_R = getTexture("media/ui/UpperArm_R.png")
}
}

View File

@@ -51,6 +51,16 @@ function ISHealthPanel.GetHighestAmputation()
end
local og_ISHealthPanel_initialise = ISHealthPanel.initialise
function ISHealthPanel:initialise()
if self.character:isFemale() then
self.sexPl = "Female"
else
self.sexPl = "Male"
end
og_ISHealthPanel_initialise(self)
end
local og_ISHealthPanel_render = ISHealthPanel.render
function ISHealthPanel:render()
og_ISHealthPanel_render(self)
@@ -60,13 +70,13 @@ function ISHealthPanel:render()
if ISHealthPanel.highestAmputations then
-- Left Texture
if ISHealthPanel.highestAmputations["L"] then
local textureL = StaticData.HEALTH_PANEL_TEXTURES[ISHealthPanel.highestAmputations["L"]]
local textureL = StaticData.HEALTH_PANEL_TEXTURES[self.sexPl][ISHealthPanel.highestAmputations["L"]]
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"]]
local textureR = StaticData.HEALTH_PANEL_TEXTURES[self.sexPl][ISHealthPanel.highestAmputations["R"]]
self:drawTexture(textureR, self.healthPanel.x/2 + 2, self.healthPanel.y/2, 1, 1, 0, 0)
end
else