diff --git a/media/lua/client/TOC/Handlers/ModDataHandler.lua b/media/lua/client/TOC/Handlers/ModDataHandler.lua index 2f3f248..5d8b25a 100644 --- a/media/lua/client/TOC/Handlers/ModDataHandler.lua +++ b/media/lua/client/TOC/Handlers/ModDataHandler.lua @@ -24,7 +24,7 @@ function ModDataHandler:new(username, isResetForced) ModData.request(key) o.tocData = ModData.get(key) - if isResetForced or o.tocData == nil or o.tocData.Hand_L == nil or o.tocData.Hand_L.isCut == nil then + if isResetForced or o.tocData == nil or o.tocData.limbs.Hand_L == nil or o.tocData.limbs.Hand_L.isCut == nil then TOC_DEBUG.print("tocData in ModDataHandler for " .. username .. " is nil, creating it now") o:setup(key) end diff --git a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua index 2947e3e..8e1b522 100644 --- a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua +++ b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua @@ -12,9 +12,20 @@ local bodyLocArmProst = StaticData.MOD_BODYLOCS_BASE_IND_STR.TOC_ArmProst ---comment ---@param item InventoryItem function ProsthesisHandler.CheckIfProst(item) + -- TODO Won't be correct when prost for legs are gonna be in return item:getBodyLocation():contains(bodyLocArmProst) end +---Get the grouping for the prosthesis +---@param item InventoryItem +---@return string +function ProsthesisHandler.GetGroup(item) + if item:getBodyLocation():contains(bodyLocArmProst) then + return StaticData.PROSTHESES_GROUPS.top + else + return StaticData.PROSTHESES_GROUPS.bottom + end +end ---Cache the correct texture for the Health Panel for the currently equipped prosthesis function ProsthesisHandler.SetHealthPanelTexture() @@ -79,10 +90,12 @@ function ISClothingExtraAction:perform() og_ISClothingExtraAction_perform(self) if ProsthesisHandler.CheckIfProst(self.item) then + local group = ProsthesisHandler.GetGroup(self.item) + TOC_DEBUG.print("applying prosthesis stuff for " .. group) local modDataHandler = ModDataHandler.GetInstance() - --modDataHandler:setIsProstEquipped + modDataHandler:setIsProstEquipped(group, true) + modDataHandler:apply() end - end