diff --git a/media/lua/client/TOC/Controllers/LocalPlayerController.lua b/media/lua/client/TOC/Controllers/LocalPlayerController.lua index 73fc2a0..319037a 100644 --- a/media/lua/client/TOC/Controllers/LocalPlayerController.lua +++ b/media/lua/client/TOC/Controllers/LocalPlayerController.lua @@ -127,8 +127,14 @@ function LocalPlayerController.TryRandomBleed(character, limbName) if chance > normCicTime then TOC_DEBUG.print("Triggered bleeding from non cicatrized wound") local adjacentBodyPartType = BodyPartType[StaticData.LIMBS_ADJACENT_IND_STR[limbName]] - character:getBodyDamage():getBodyPart(adjacentBodyPartType):setBleeding(true) - character:getBodyDamage():getBodyPart(adjacentBodyPartType):setBleedingTime(20) + + -- we need to check if the wound is already bleeding before doing anything else to prevent issues with bandages + local bp = character:getBodyDamage():getBodyPart(adjacentBodyPartType) + bp:setBleedingTime(20) -- TODO Should depend on cicatrization instead of a fixed time + -- ADD Could break bandages if bleeding is too much? + + + --character:getBodyDamage():getBodyPart(adjacentBodyPartType):setBleeding(true) end end diff --git a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua index 9f7f4be..edd1f23 100644 --- a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua +++ b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua @@ -132,36 +132,26 @@ function ISClothingExtraAction:isValid() return HandleProsthesisValidation(testItem, isEquippable) end ---[[ + +local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform +function ISClothingExtraAction:perform() + local extraItem = InventoryItemFactory.CreateItem(self.extra) + ProsthesisHandler.SearchAndSetupProsthesis(extraItem, true) + og_ISClothingExtraAction_perform(self) +end + +local og_ISUnequipAction_perform = ISUnequipAction.perform +function ISUnequipAction:perform() + + --[[ Horrendous workaround To unequp items, the java side uses WornItems.setItem, which has a check for multiItem. Basically, if it's active, it won't actually remove the item, fucking things up. So, to be 100% sure that we're removing the items, we're gonna disable and re-enable the multi-item bool for the Unequip Action. -]] + ]] - - -local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform -function ISClothingExtraAction:perform() - local extraItem = InventoryItemFactory.CreateItem(self.extra) - local isProst = ProsthesisHandler.SearchAndSetupProsthesis(extraItem, true) - local group - if isProst then - group = BodyLocations.getGroup("Human") - group:setMultiItem("TOC_ArmProst", false) - end - - og_ISClothingExtraAction_perform(self) - - if isProst then - group:setMultiItem("TOC_ArmProst", true) - end -end - -local og_ISUnequipAction_perform = ISUnequipAction.perform -function ISUnequipAction:perform() local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false) local group if isProst then diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index eed44ae..0cd183c 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.8" + _version = "2.0.9" } function Main.Start() diff --git a/media/lua/client/TOC/Tests.lua b/media/lua/client/TOC/Tests.lua index 170ef6c..a636c15 100644 --- a/media/lua/client/TOC/Tests.lua +++ b/media/lua/client/TOC/Tests.lua @@ -145,6 +145,14 @@ end) TestFramework.registerTestModule("Various", "Player", function() local Tests = {} + + function Tests.BleedTest() + local pl = getPlayer() + + --pl:getBodyDamage():getBodyPart(BodyPartType.ForeArm_R):setBleeding(true) + pl:getBodyDamage():getBodyPart(BodyPartType.ForeArm_R):setBleedingTime(20) + end + function Tests.Kill() getPlayer():Kill(getPlayer()) end diff --git a/mod.info b/mod.info index 0c0eafb..54abb68 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.8 +modversion=2.0.9 pzversion=41.65