From 26e0324f4ad6d21c60131e5a8829b794cdc45ab8 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Tue, 7 May 2024 17:04:32 +0200 Subject: [PATCH] Fixed bug related to BodyLocations that would break equipping prosthesis --- .../client/TOC/Handlers/ProsthesisHandler.lua | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) 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