From a7e32bc69befa231c18afe9375bd9387137fae1c Mon Sep 17 00:00:00 2001 From: ZioPao Date: Thu, 9 May 2024 14:46:31 +0200 Subject: [PATCH 1/2] Fix to HandleDamage breaking when getIsIgnoredPartInfected==true --- .../TOC/Controllers/LocalPlayerController.lua | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/media/lua/client/TOC/Controllers/LocalPlayerController.lua b/media/lua/client/TOC/Controllers/LocalPlayerController.lua index 319037a..27e0c5c 100644 --- a/media/lua/client/TOC/Controllers/LocalPlayerController.lua +++ b/media/lua/client/TOC/Controllers/LocalPlayerController.lua @@ -147,7 +147,6 @@ LocalPlayerController.hasBeenDamaged = false ---Check if the player has in infected body part or if they have been hit in a cut area ---@param character IsoPlayer|IsoGameCharacter function LocalPlayerController.HandleDamage(character) - -- TOC_DEBUG.print("Player got hit!") -- TOC_DEBUG.print(damageType) if character ~= getPlayer() then return end local bd = character:getBodyDamage() @@ -179,18 +178,17 @@ function LocalPlayerController.HandleDamage(character) -- Check other body parts that are not included in the mod, if there's a bite there then the player is fucked -- We can skip this loop if the player has been infected. The one before we kinda need it to handle correctly the bites in case the player wanna cut stuff off anyway - if dcInst:getIsIgnoredPartInfected() then return end - - for i = 1, #StaticData.IGNORED_BODYLOCS_BPT do - local bodyPartType = StaticData.IGNORED_BODYLOCS_BPT[i] - local bodyPart = bd:getBodyPart(bodyPartType) - if bodyPart and (bodyPart:bitten() or bodyPart:IsInfected()) then - dcInst:setIsIgnoredPartInfected(true) - modDataNeedsUpdate = true + if not dcInst:getIsIgnoredPartInfected() then + for i = 1, #StaticData.IGNORED_BODYLOCS_BPT do + local bodyPartType = StaticData.IGNORED_BODYLOCS_BPT[i] + local bodyPart = bd:getBodyPart(bodyPartType) + if bodyPart and (bodyPart:bitten() or bodyPart:IsInfected()) then + dcInst:setIsIgnoredPartInfected(true) + modDataNeedsUpdate = true + end end end - -- TODO in theory should sync modData, but it's gonna be expensive as fuck. Figure it out if modDataNeedsUpdate then dcInst:apply() end @@ -205,6 +203,7 @@ end ---@param damageAmount number function LocalPlayerController.OnGetDamage(character, damageType, damageAmount) -- TODO Check if other players in the online triggers this + TOC_DEBUG.print("Player got hit!") if LocalPlayerController.hasBeenDamaged == false then -- Start checks From 36c3418a3e5fe627133be5bfc529184c9ac59469 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Thu, 9 May 2024 14:47:28 +0200 Subject: [PATCH 2/2] bump to mod version --- media/lua/client/TOC/Main.lua | 2 +- mod.info | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index 0cd183c..55ac0ef 100644 --- a/media/lua/client/TOC/Main.lua +++ b/media/lua/client/TOC/Main.lua @@ -6,7 +6,7 @@ require("TOC/Events") ---@class Main local Main = { - _version = "2.0.9" + _version = "2.0.10" } function Main.Start() diff --git a/mod.info b/mod.info index 54abb68..42be3ff 100644 --- a/mod.info +++ b/mod.info @@ -4,5 +4,5 @@ description=You've been bitten. You have only two choices. id=TheOnlyCure icon=icon.png url=https://github.com/ZioPao/The-Only-Cure -modversion=2.0.9 +modversion=2.0.10 pzversion=41.65