pushing before fucking everything up

This commit is contained in:
ZioPao
2023-11-14 01:46:12 +01:00
parent 33299b0779
commit 150772e252
4 changed files with 51 additions and 7 deletions

View File

@@ -47,16 +47,25 @@ function ModDataHandler:setup(key)
self.tocData = { self.tocData = {
-- Generic stuff that does not belong anywhere else -- Generic stuff that does not belong anywhere else
isIgnoredPartInfected = false, isIgnoredPartInfected = false,
isAnyLimbCut = false isAnyLimbCut = false,
prosthesis = {
top = {},
bottom = {}
}
} }
---@type partData ---@type partData
local defaultParams = { local defaultParams = {
isCut = false, isInfected = false, isOperated = false, isCicatrized = false, isCut = false, isInfected = false, isOperated = false, isCicatrized = false,
isCauterized = false, isVisible = false, isProstEquipped = false, prostFactor = 0 isCauterized = false, isVisible = false
} }
-- TODO Set this up for legs crap
-- Initialize limbs -- Initialize limbs
--self.tocData.limbs = {}
for i=1, #StaticData.LIMBS_STRINGS do for i=1, #StaticData.LIMBS_STRINGS do
local limbName = StaticData.LIMBS_STRINGS[i] local limbName = StaticData.LIMBS_STRINGS[i]
self.tocData[limbName] = {} self.tocData[limbName] = {}

View File

@@ -94,7 +94,6 @@ end
Events.OnPlayerGetDamage.Add(PlayerHandler.CheckInfection) Events.OnPlayerGetDamage.Add(PlayerHandler.CheckInfection)
--* Events *--
---Updates the cicatrization process, run when a limb has been cut ---Updates the cicatrization process, run when a limb has been cut
function PlayerHandler.UpdateCicatrization() function PlayerHandler.UpdateCicatrization()
if ModDataHandler.GetInstance():getIsAnyLimbCut() == false then return end if ModDataHandler.GetInstance():getIsAnyLimbCut() == false then return end
@@ -103,6 +102,7 @@ function PlayerHandler.UpdateCicatrization()
end end
------------------------------------------ ------------------------------------------
--* OVERRIDES *-- --* OVERRIDES *--

View File

@@ -1,10 +1,21 @@
local CommonMethods = require("TOC/CommonMethods") local CommonMethods = require("TOC/CommonMethods")
local StaticData = require("TOC/StaticData")
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler") local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
------------------------- -------------------------
---@class ProsthesisHandler ---@class ProsthesisHandler
local 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 ---Cache the correct texture for the Health Panel for the currently equipped prosthesis
function ProsthesisHandler.SetHealthPanelTexture() function ProsthesisHandler.SetHealthPanelTexture()
-- TODO do it -- TODO do it
@@ -18,7 +29,7 @@ function ProsthesisHandler.CheckIfEquippable(bodyLocation)
local side = CommonMethods.GetSide(bodyLocation) local side = CommonMethods.GetSide(bodyLocation)
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(getPlayer():getUsername()) local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(getPlayer():getUsername())
for i=1, #amputatedLimbs do for i = 1, #amputatedLimbs do
local limbName = amputatedLimbs[i] local limbName = amputatedLimbs[i]
if string.contains(limbName, side) and not string.contains(limbName, "UpperArm") then if string.contains(limbName, side) and not string.contains(limbName, "UpperArm") then
return true return true
@@ -29,13 +40,19 @@ function ProsthesisHandler.CheckIfEquippable(bodyLocation)
getPlayer():Say("I can't equip this") getPlayer():Say("I can't equip this")
return false return false
end end
-------------------------
--* Events *--
-------------------------
--* Overrides *-- --* Overrides *--
---@diagnostic disable-next-line: duplicate-set-field ---@diagnostic disable-next-line: duplicate-set-field
function ISWearClothing:isValid() function ISWearClothing:isValid()
local bodyLocation = self.item:getBodyLocation() local bodyLocation = self.item:getBodyLocation()
if not string.contains(bodyLocation, "TOC_ArmProst") then if not string.contains(bodyLocation, bodyLocArmProst) then
return true return true
else else
return ProsthesisHandler.CheckIfEquippable(bodyLocation) return ProsthesisHandler.CheckIfEquippable(bodyLocation)
@@ -47,7 +64,7 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid
function ISClothingExtraAction:isValid() function ISClothingExtraAction:isValid()
local bodyLocation = self.item:getBodyLocation() local bodyLocation = self.item:getBodyLocation()
local isEquippable = false 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 isEquippable = true
else else
isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation) isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation)
@@ -57,4 +74,17 @@ function ISClothingExtraAction:isValid()
end 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

View File

@@ -13,6 +13,11 @@ StaticData.PARTS_STRINGS = {
UpperArm = "UpperArm" UpperArm = "UpperArm"
} }
StaticData.BODYLOCATIONS_BASE_STRINGS = {
TOC_ArmProst = "TOC_ArmProst",
TOC_Arm = "TOC_Arm",
}
-- No "MAX" here. -- No "MAX" here.
StaticData.IGNORED_PARTS_STRINGS = { "Foot_L", "Foot_R", "Groin", "Head", "LowerLeg_L", "LowerLeg_R", "Neck", "Torso_Lower", "Torso_Upper", "UpperLeg_L", "UpperLeg_R" } StaticData.IGNORED_PARTS_STRINGS = { "Foot_L", "Foot_R", "Groin", "Head", "LowerLeg_L", "LowerLeg_R", "Neck", "Torso_Lower", "Torso_Upper", "UpperLeg_L", "UpperLeg_R" }