Fixed prosthesis not working correctly

This commit is contained in:
ZioPao
2024-05-05 00:47:50 +02:00
parent aadbe02df4
commit 5cc982188a
6 changed files with 40 additions and 24 deletions

View File

@@ -111,6 +111,8 @@ end
--* Hand feasibility caching *--
CachedDataHandler.handFeasibility = {}

View File

@@ -70,11 +70,10 @@ function ProsthesisHandler.CheckIfEquippable(fullType)
return false
end
---Handle equipping or unequipping prosthetics
---@param item InventoryItem
---@param isEquipping boolean
---@return boolean
---@return boolean
function ProsthesisHandler.SearchAndSetupProsthesis(item, isEquipping)
if not ProsthesisHandler.CheckIfProst(item) then return false end
@@ -100,7 +99,7 @@ local function HandleProsthesisValidation(item, isEquippable)
local isProst = ProsthesisHandler.CheckIfProst(item)
if not isProst then return isEquippable end
local fullType = item:getFullType() -- use fulltype for side
local fullType = item:getFullType() -- use fulltype for side
if isEquippable then
isEquippable = ProsthesisHandler.CheckIfEquippable(fullType)
else
@@ -133,8 +132,6 @@ function ISClothingExtraAction:isValid()
return HandleProsthesisValidation(testItem, isEquippable)
end
--[[
Horrendous workaround
@@ -161,7 +158,6 @@ function ISClothingExtraAction:perform()
if isProst then
group:setMultiItem("TOC_ArmProst", true)
end
end
local og_ISUnequipAction_perform = ISUnequipAction.perform
@@ -176,8 +172,15 @@ function ISUnequipAction:perform()
if isProst then
group:setMultiItem("TOC_ArmProst", true)
-- we need to fetch the limbname associated to the prosthesis
local side = CommonMethods.GetSide(self.item:getFullType())
local highestAmputatedLimbs = CachedDataHandler.GetHighestAmputatedLimbs(getPlayer():getUsername())
if highestAmputatedLimbs then
local hal = highestAmputatedLimbs[side]
triggerEvent("OnProsthesisUnequipped", hal)
end
end
end
return ProsthesisHandler