diff --git a/media/lua/client/TOC/Handlers/PlayerHandler.lua b/media/lua/client/TOC/Handlers/PlayerHandler.lua index 3145cca..ab41ca2 100644 --- a/media/lua/client/TOC/Handlers/PlayerHandler.lua +++ b/media/lua/client/TOC/Handlers/PlayerHandler.lua @@ -225,9 +225,7 @@ function PlayerHandler.UpdateCicatrization() TOC_DEBUG.print("updating cicatrization for " .. tostring(limbName)) -- TODO Check if bandaged, sutured, whatever - -- TODO Clean - -- TODO Check dirtyness of zone and add to it --local bptEnum = StaticData.BODYLOCS_IND_BPT[limbName] @@ -236,12 +234,16 @@ function PlayerHandler.UpdateCicatrization() local bbptEnum = BloodBodyPartType[limbName] --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) TOC_DEBUG.print("dirtyness for this zone: " .. tostring(dirtyness)) - cicTime = cicTime - SandboxVars.TOC.CicatrizationSpeed modDataHandler:setCicatrizationTime(limbName, cicTime) TOC_DEBUG.print("new cicatrization time: " .. tostring(cicTime)) @@ -249,7 +251,6 @@ function PlayerHandler.UpdateCicatrization() TOC_DEBUG.print(tostring(limbName) .. " is cicatrized") modDataHandler:setIsCicatrized(limbName, true) end - end end diff --git a/media/lua/client/TOC/TimedActions/CleanWoundAction.lua b/media/lua/client/TOC/TimedActions/CleanWoundAction.lua index 7ef004f..b8d14b9 100644 --- a/media/lua/client/TOC/TimedActions/CleanWoundAction.lua +++ b/media/lua/client/TOC/TimedActions/CleanWoundAction.lua @@ -61,16 +61,27 @@ function CleanWoundAction:perform() --self.bodyPart:setNeedBurnWash(false) self.bandage:Use() + -- TODO Use Water too + if isClient() then - local limbName = CommonMethods.GetLimbNameFromBodyPart(self.bodyPart) - - -- TODO CHeck if correct in MP - local modDataHandler = ModDataHandler.GetInstance(self.character:getUsername()) - - modDataHandler:setWoundDirtyness(limbName, 0) --sendCleanBurn(self.character, self.otherPlayer, self.bodyPart, self.bandage) end + local limbName = CommonMethods.GetLimbNameFromBodyPart(self.bodyPart) + + -- TODO CHeck if correct in MP + local modDataHandler = ModDataHandler.GetInstance(self.otherPlayer:getUsername()) + modDataHandler:setWoundDirtyness(limbName, 0) + + + -- 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) end diff --git a/media/lua/client/TOC/UI/HealthPanel.lua b/media/lua/client/TOC/UI/HealthPanel.lua index 4174854..42a0a8e 100644 --- a/media/lua/client/TOC/UI/HealthPanel.lua +++ b/media/lua/client/TOC/UI/HealthPanel.lua @@ -200,6 +200,10 @@ function ISHealthBodyPartListBox:doDrawItem(y, item, alt) local maxCicaTime = StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[limbName] 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) + 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 y = y + fontHgt diff --git a/media/lua/client/TOC/UI/WoundCleaningInteraction.lua b/media/lua/client/TOC/UI/WoundCleaningInteraction.lua index 790735c..a5d873f 100644 --- a/media/lua/client/TOC/UI/WoundCleaningInteraction.lua +++ b/media/lua/client/TOC/UI/WoundCleaningInteraction.lua @@ -22,7 +22,6 @@ function WoundCleaningHandler:new(panel, bodyPart, username) o.limbName = CommonMethods.GetLimbNameFromBodyPart(bodyPart) - return o end @@ -72,7 +71,7 @@ end function WoundCleaningHandler:perform(previousAction, itemType) local item = self:getItemOfType(self.items.ITEMS, itemType) previousAction = self:toPlayerInventory(item, previousAction) - local action = CleanWoundAction :new(self:getDoctor(), self:getPatient(), item, self.bodyPart) + local action = CleanWoundAction:new(self:getDoctor(), self:getPatient(), item, self.bodyPart) ISTimedActionQueue.addAfter(previousAction, action) end diff --git a/media/lua/shared/Translate/EN/IG_UI_EN.txt b/media/lua/shared/Translate/EN/IG_UI_EN.txt index 06e9daf..082b8dd 100644 --- a/media/lua/shared/Translate/EN/IG_UI_EN.txt +++ b/media/lua/shared/Translate/EN/IG_UI_EN.txt @@ -11,5 +11,6 @@ IG_UI_EN = { IGUI_HealthPanel_Cicatrization = "Cicatrization", IGUI_HealthPanel_Cicatrized = "Cicatrized", IGUI_HealthPanel_Cauterized = "Cauterized", + IGUI_HealthPanel_WoundDirtyness = "Wound Dirtyness", } \ No newline at end of file