fixes after changing some data structure

This commit is contained in:
ZioPao
2023-11-14 23:30:28 +01:00
parent 65795cbe79
commit a7d49c7253
2 changed files with 16 additions and 3 deletions

View File

@@ -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

View File

@@ -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