Simplifield health panel logic

This commit is contained in:
ZioPao
2024-01-08 16:09:10 +01:00
parent c35454807d
commit d3722c1171
2 changed files with 170 additions and 213 deletions

View File

@@ -407,8 +407,6 @@ end
---A recreation of the original method, but with amputations in mind
---@param dcInst DataController
function ISEquipWeaponAction:performWithAmputation(dcInst)
-- TODO Simplify this
local hand = nil
local otherHand = nil
local getMethodFirst = nil

View File

@@ -14,7 +14,6 @@ function SetHealthPanelTOC()
isReady = true
end
--function OverrideHealthPanelForTOC()
-- We're overriding ISHealthPanel to add custom textures to the body panel.
-- By doing so we can show the player which limbs have been cut without having to use another menu
@@ -61,30 +60,6 @@ end
--* Modifications and additional methods to handle visible amputation on the health menu *--
local og_ISHealthPanel_initialise = ISHealthPanel.initialise
function ISHealthPanel:initialise()
if self.character:isFemale() then
self.sexPl = "Female"
else
self.sexPl = "Male"
end
local username = self.character:getUsername()
if username ~= "Bob" then
--CachedDataHandler.CalculateHighestAmputatedLimbs(username)
self.highestAmputations = CachedDataHandler.GetHighestAmputatedLimbs(username)
end
og_ISHealthPanel_initialise(self)
end
local og_ISHealthPanel_setOtherPlayer = ISHealthPanel.setOtherPlayer
---@param playerObj IsoPlayer
function ISHealthPanel:setOtherPlayer(playerObj)
og_ISHealthPanel_setOtherPlayer(self, playerObj)
--CachedDataHandler.CalculateAmputatedLimbs(self.character:getUsername())
end
---Get a value between 1 and 0.1 for the cicatrization time
---@param cicTime integer
---@return integer
@@ -112,13 +87,7 @@ end
local cicTime = DataController.GetInstance(username):getCicatrizationTime(limbName)
redColor = GetColorFromCicatrizationTime(cicTime, limbName)
local sexPl
if self.character:isFemale() then
sexPl = "Female"
else
sexPl = "Male"
end
local sexPl = self.character:isFemale() and "Female" or "Male"
texture = StaticData.HEALTH_PANEL_TEXTURES[sexPl][limbName]
end
@@ -129,22 +98,14 @@ end
function ISHealthPanel:render()
og_ISHealthPanel_render(self)
local username = self.character:getUsername()
--CachedDataHandler.CalculateHighestAmputatedLimbs(username)
local highestAmputations = CachedDataHandler.GetHighestAmputatedLimbs(username)
-- TODO Client should send update to other client somehow
if highestAmputations ~= nil then
-- Left Texture
self:tryDrawHighestAmputation(highestAmputations, "L", username)
-- Right Texture
self:tryDrawHighestAmputation(highestAmputations, "R", username)
-- else
-- -- Request caching data
-- TOC_DEBUG.print("highest amputated limbs was nil, calculating and getting it now for " .. username)
-- CachedDataHandler.CalculateHighestAmputatedLimbs(username)
end
end
@@ -267,5 +228,3 @@ end
return og_ISHealthPanel_getDamagedParts(self)
end
end
--end