Cleaning cleans wounds and visual too

This commit is contained in:
ZioPao
2023-12-30 00:09:54 -05:00
parent 4e4b771e41
commit f2007d56a9
5 changed files with 29 additions and 13 deletions

View File

@@ -225,9 +225,7 @@ function PlayerHandler.UpdateCicatrization()
TOC_DEBUG.print("updating cicatrization for " .. tostring(limbName)) TOC_DEBUG.print("updating cicatrization for " .. tostring(limbName))
-- TODO Check if bandaged, sutured, whatever -- TODO Check if bandaged, sutured, whatever
-- TODO Clean -- TODO Clean
-- TODO Check dirtyness of zone and add to it -- TODO Check dirtyness of zone and add to it
--local bptEnum = StaticData.BODYLOCS_IND_BPT[limbName] --local bptEnum = StaticData.BODYLOCS_IND_BPT[limbName]
@@ -236,12 +234,16 @@ function PlayerHandler.UpdateCicatrization()
local bbptEnum = BloodBodyPartType[limbName] local bbptEnum = BloodBodyPartType[limbName]
--local bodyPart = bd:getBodyPart(bptEnum) --local bodyPart = bd:getBodyPart(bptEnum)
local dirtyness = visual:getDirt(bbptEnum) + visual:getBlood(bbptEnum) + modDataHandler:getWoundDirtyness(limbName) local dirtyness = visual:getDirt(bbptEnum) + visual:getBlood(bbptEnum) + modDataHandler:getWoundDirtyness(limbName) + 0.01 -- TODO Make it customizable
if dirtyness > 1 then
dirtyness = 1
end
modDataHandler:setWoundDirtyness(limbName, dirtyness) modDataHandler:setWoundDirtyness(limbName, dirtyness)
TOC_DEBUG.print("dirtyness for this zone: " .. tostring(dirtyness)) TOC_DEBUG.print("dirtyness for this zone: " .. tostring(dirtyness))
cicTime = cicTime - SandboxVars.TOC.CicatrizationSpeed cicTime = cicTime - SandboxVars.TOC.CicatrizationSpeed
modDataHandler:setCicatrizationTime(limbName, cicTime) modDataHandler:setCicatrizationTime(limbName, cicTime)
TOC_DEBUG.print("new cicatrization time: " .. tostring(cicTime)) TOC_DEBUG.print("new cicatrization time: " .. tostring(cicTime))
@@ -249,7 +251,6 @@ function PlayerHandler.UpdateCicatrization()
TOC_DEBUG.print(tostring(limbName) .. " is cicatrized") TOC_DEBUG.print(tostring(limbName) .. " is cicatrized")
modDataHandler:setIsCicatrized(limbName, true) modDataHandler:setIsCicatrized(limbName, true)
end end
end end
end end

View File

@@ -61,15 +61,26 @@ function CleanWoundAction:perform()
--self.bodyPart:setNeedBurnWash(false) --self.bodyPart:setNeedBurnWash(false)
self.bandage:Use() self.bandage:Use()
-- TODO Use Water too
if isClient() then if isClient() then
--sendCleanBurn(self.character, self.otherPlayer, self.bodyPart, self.bandage)
end
local limbName = CommonMethods.GetLimbNameFromBodyPart(self.bodyPart) local limbName = CommonMethods.GetLimbNameFromBodyPart(self.bodyPart)
-- TODO CHeck if correct in MP -- TODO CHeck if correct in MP
local modDataHandler = ModDataHandler.GetInstance(self.character:getUsername()) local modDataHandler = ModDataHandler.GetInstance(self.otherPlayer:getUsername())
modDataHandler:setWoundDirtyness(limbName, 0) modDataHandler:setWoundDirtyness(limbName, 0)
--sendCleanBurn(self.character, self.otherPlayer, self.bodyPart, self.bandage)
end
-- Clean visual
local bbptEnum = BloodBodyPartType[limbName]
---@type HumanVisual
local visual = self.otherPlayer:getHumanVisual()
visual:setDirt(bbptEnum, 0)
visual:setBlood(bbptEnum, 0)
ISHealthPanel.setBodyPartActionForPlayer(self.otherPlayer, self.bodyPart, nil, nil, nil) ISHealthPanel.setBodyPartActionForPlayer(self.otherPlayer, self.bodyPart, nil, nil, nil)
end end

View File

@@ -200,6 +200,10 @@ function ISHealthBodyPartListBox:doDrawItem(y, item, alt)
local maxCicaTime = StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[limbName] local maxCicaTime = StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[limbName]
local percentage = (1 - cicaTime/maxCicaTime) * 100 local percentage = (1 - cicaTime/maxCicaTime) * 100
self:drawText("- " .. getText("IGUI_HealthPanel_Cicatrization") .. string.format(" %.2f", percentage) .. "%", x, y, 0.89, 0.28, 0.28, 1, UIFont.Small) self:drawText("- " .. getText("IGUI_HealthPanel_Cicatrization") .. string.format(" %.2f", percentage) .. "%", x, y, 0.89, 0.28, 0.28, 1, UIFont.Small)
y = y + fontHgt
local scaledDirtyness = math.floor(modDataHandler:getWoundDirtyness(limbName) * 100)
self:drawText("- " .. getText("IGUI_HealthPanel_WoundDirtyness") .. string.format(" %d", scaledDirtyness) .. "%", x, y, 0.89, 0.28, 0.28, 1, UIFont.Small)
end end
y = y + fontHgt y = y + fontHgt

View File

@@ -22,7 +22,6 @@ function WoundCleaningHandler:new(panel, bodyPart, username)
o.limbName = CommonMethods.GetLimbNameFromBodyPart(bodyPart) o.limbName = CommonMethods.GetLimbNameFromBodyPart(bodyPart)
return o return o
end end

View File

@@ -11,5 +11,6 @@ IG_UI_EN = {
IGUI_HealthPanel_Cicatrization = "Cicatrization", IGUI_HealthPanel_Cicatrization = "Cicatrization",
IGUI_HealthPanel_Cicatrized = "Cicatrized", IGUI_HealthPanel_Cicatrized = "Cicatrized",
IGUI_HealthPanel_Cauterized = "Cauterized", IGUI_HealthPanel_Cauterized = "Cauterized",
IGUI_HealthPanel_WoundDirtyness = "Wound Dirtyness",
} }