cicatrization process

This commit is contained in:
ZioPao
2023-11-16 12:50:07 +01:00
parent c09c3ac646
commit 34570cd013
7 changed files with 114 additions and 18 deletions

View File

@@ -5,6 +5,13 @@ local PlayerHandler = require("TOC/Handlers/PlayerHandler")
local StaticData = require("TOC/StaticData")
---------------------------
--Triggered when a limb has been amputated
---@class Events
---@field OnAmputatedLimb any
LuaEventManager.AddEvent("OnAmputatedLimb")
--------------
-- TODO Add Bandages, Torniquet, etc.
--- Manages an amputation. Will be run on the patient client
---@class AmputationHandler
@@ -150,15 +157,17 @@ function AmputationHandler:execute(damagePlayer)
CachedDataHandler.AddAmputatedLimb(username, self.limbName)
CachedDataHandler.CalculateHighestAmputatedLimbs(username)
-- TODO Check infection level!
-- If the part was actually infected, heal the player, if they were in time
if bodyPart:IsInfected() and not modDataHandler:getIsIgnoredPartInfected() then
-- If the part was actually infected, heal the player, if they were in time (infectionLevel < 20)
if bd:getInfectionLevel() < 20 and bodyPart:IsInfected() and not modDataHandler:getIsIgnoredPartInfected() then
PlayerHandler.HealZombieInfection(bd, bodyPart, self.limbName, modDataHandler)
end
-- The last part is to handle the damage that the player will receive after the amputation
if not damagePlayer then return end
self:damageAfterAmputation(surgeonFactor)
-- Trigger this event
triggerEvent("OnAmputatedLimb")
end
---Deletes the instance