Refactor tourniquet check and update patient stats

This commit is contained in:
guiriguy
2025-12-18 22:48:00 +01:00
committed by GitHub
parent da7621c0f0
commit b650b2a590

View File

@@ -52,7 +52,7 @@ function AmputationHandler.ApplyDamageDuringAmputation(player, limbName)
-- Check if tourniquet is applied on the zone -- Check if tourniquet is applied on the zone
for bl, tournAmpGroup in pairs(StaticData.TOURNIQUET_BODYLOCS_TO_GROUPS_IND_STR) do for bl, tournAmpGroup in pairs(StaticData.TOURNIQUET_BODYLOCS_TO_GROUPS_IND_STR) do
local item = player:getWornItem(ItemBodyLocation[bl]) local item = player:getWornItem(bl)
-- LimbName -> Group -> BodyLoc -- LimbName -> Group -> BodyLoc
if item and tournAmpGroup == ampGroup then if item and tournAmpGroup == ampGroup then
@@ -152,8 +152,8 @@ function AmputationHandler:damageAfterAmputation(surgeonFactor)
bodyPart:setBleedingTime(baseDamage - surgeonFactor) bodyPart:setBleedingTime(baseDamage - surgeonFactor)
bodyPart:setDeepWounded(true) bodyPart:setDeepWounded(true)
bodyPart:setDeepWoundTime(baseDamage - surgeonFactor) bodyPart:setDeepWoundTime(baseDamage - surgeonFactor)
patientStats:setEndurance(surgeonFactor) patientStats:set(CharacterStat.ENDURANCE, surgeonFactor)
patientStats:setStress(baseDamage - surgeonFactor) patientStats:set(CharacterStat.STRESS, baseDamage - surgeonFactor)
end end
---Execute the amputation. This method doesn't check if the upper limb has been amputated or not, so if ---Execute the amputation. This method doesn't check if the upper limb has been amputated or not, so if
@@ -191,7 +191,7 @@ function AmputationHandler:execute(damagePlayer)
CachedDataHandler.CalculateCacheableValues(username) CachedDataHandler.CalculateCacheableValues(username)
-- If the part was actually infected, heal the player, if they were in time (infectionLevel < 20) -- 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 dcInst:getIsIgnoredPartInfected() then if bd:getGeneralWoundInfectionLevel() < 20 and bodyPart:IsInfected() and not dcInst:getIsIgnoredPartInfected() then
LocalPlayerController.HealZombieInfection(bd, bodyPart, self.limbName, dcInst) LocalPlayerController.HealZombieInfection(bd, bodyPart, self.limbName, dcInst)
end end
@@ -208,4 +208,4 @@ function AmputationHandler:close()
AmputationHandler.instance = nil AmputationHandler.instance = nil
end end
return AmputationHandler return AmputationHandler