pushing before fucking everything up
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
local CommonMethods = require("TOC/CommonMethods")
|
||||
local StaticData = require("TOC/StaticData")
|
||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||
-------------------------
|
||||
|
||||
---@class ProsthesisHandler
|
||||
local ProsthesisHandler = {}
|
||||
|
||||
local bodyLocArmProst = StaticData.BODYLOCATIONS_BASE_STRINGS.TOC_ArmProst
|
||||
|
||||
---comment
|
||||
---@param item InventoryItem
|
||||
function ProsthesisHandler.CheckIfProst(item)
|
||||
return item:getBodyLocation():contains(bodyLocArmProst)
|
||||
end
|
||||
|
||||
|
||||
---Cache the correct texture for the Health Panel for the currently equipped prosthesis
|
||||
function ProsthesisHandler.SetHealthPanelTexture()
|
||||
-- TODO do it
|
||||
@@ -18,7 +29,7 @@ function ProsthesisHandler.CheckIfEquippable(bodyLocation)
|
||||
local side = CommonMethods.GetSide(bodyLocation)
|
||||
|
||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(getPlayer():getUsername())
|
||||
for i=1, #amputatedLimbs do
|
||||
for i = 1, #amputatedLimbs do
|
||||
local limbName = amputatedLimbs[i]
|
||||
if string.contains(limbName, side) and not string.contains(limbName, "UpperArm") then
|
||||
return true
|
||||
@@ -29,13 +40,19 @@ function ProsthesisHandler.CheckIfEquippable(bodyLocation)
|
||||
getPlayer():Say("I can't equip this")
|
||||
return false
|
||||
end
|
||||
-------------------------
|
||||
--* Events *--
|
||||
|
||||
|
||||
|
||||
|
||||
-------------------------
|
||||
--* Overrides *--
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function ISWearClothing:isValid()
|
||||
local bodyLocation = self.item:getBodyLocation()
|
||||
if not string.contains(bodyLocation, "TOC_ArmProst") then
|
||||
if not string.contains(bodyLocation, bodyLocArmProst) then
|
||||
return true
|
||||
else
|
||||
return ProsthesisHandler.CheckIfEquippable(bodyLocation)
|
||||
@@ -47,7 +64,7 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid
|
||||
function ISClothingExtraAction:isValid()
|
||||
local bodyLocation = self.item:getBodyLocation()
|
||||
local isEquippable = false
|
||||
if og_ISClothingExtraAction_isValid(self) and not string.contains(bodyLocation, "TOC_ArmProst") then
|
||||
if og_ISClothingExtraAction_isValid(self) and not string.contains(bodyLocation, bodyLocArmProst) then
|
||||
isEquippable = true
|
||||
else
|
||||
isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation)
|
||||
@@ -57,4 +74,17 @@ function ISClothingExtraAction:isValid()
|
||||
end
|
||||
|
||||
|
||||
return ProsthesisHandler
|
||||
local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform
|
||||
function ISClothingExtraAction:perform()
|
||||
og_ISClothingExtraAction_perform(self)
|
||||
|
||||
if ProsthesisHandler.CheckIfProst(self.item) then
|
||||
local modDataHandler = ModDataHandler.GetInstance()
|
||||
--modDataHandler:setIsProstEquipped
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
return ProsthesisHandler
|
||||
|
||||
Reference in New Issue
Block a user