Fixes, placeholders, and getters\setters

This commit is contained in:
ZioPao
2023-11-14 01:17:46 +01:00
parent 46175908b1
commit 33299b0779
14 changed files with 80 additions and 33 deletions

View File

@@ -6,6 +6,5 @@
<m_Static>false</m_Static> <m_Static>false</m_Static>
<m_AllowRandomTint>false</m_AllowRandomTint> <m_AllowRandomTint>false</m_AllowRandomTint>
<textureChoices>metal_base</textureChoices> <textureChoices>Prosthesis\hookArmTest</textureChoices>
<textureChoices>metal_base</textureChoices>
</clothingItem> </clothingItem>

View File

@@ -6,6 +6,5 @@
<m_Static>false</m_Static> <m_Static>false</m_Static>
<m_AllowRandomTint>false</m_AllowRandomTint> <m_AllowRandomTint>false</m_AllowRandomTint>
<textureChoices>metal_base</textureChoices> <textureChoices>Prosthesis\hookArmTest</textureChoices>
<textureChoices>metal_base</textureChoices>
</clothingItem> </clothingItem>

View File

@@ -25,6 +25,7 @@ function ItemsHandler.GetAmputationTexturesIndex(playerObj, isCicatrized)
matchedIndex = matchedIndex + 5 matchedIndex = matchedIndex + 5
end end
if isCicatrized then if isCicatrized then
if isHairy then if isHairy then
matchedIndex = matchedIndex + 5 -- to use the cicatrized texture on hairy bodies matchedIndex = matchedIndex + 5 -- to use the cicatrized texture on hairy bodies

View File

@@ -51,7 +51,10 @@ function ModDataHandler:setup(key)
} }
---@type partData ---@type partData
local defaultParams = {isCut = false, isInfected = false, isOperated = false, isCicatrized = false, isCauterized = false, isVisible = false} local defaultParams = {
isCut = false, isInfected = false, isOperated = false, isCicatrized = false,
isCauterized = false, isVisible = false, isProstEquipped = false, prostFactor = 0
}
-- Initialize limbs -- Initialize limbs
for i=1, #StaticData.LIMBS_STRINGS do for i=1, #StaticData.LIMBS_STRINGS do
@@ -76,6 +79,12 @@ function ModDataHandler:setIsAnyLimbCut(isAnyLimbCut)
self.tocData.isAnyLimbCut = isAnyLimbCut self.tocData.isAnyLimbCut = isAnyLimbCut
end end
---Set isIgnoredPartInfected
---@param isIgnoredPartInfected boolean
function ModDataHandler:setIsIgnoredPartInfected(isIgnoredPartInfected)
self.tocData.isIgnoredPartInfected = isIgnoredPartInfected
end
---Set isCut ---Set isCut
---@param limbName string ---@param limbName string
---@param isCut boolean ---@param isCut boolean
@@ -90,10 +99,18 @@ function ModDataHandler:setIsInfected(limbName, isInfected)
self.tocData[limbName].isInfected = isInfected self.tocData[limbName].isInfected = isInfected
end end
---Set isIgnoredPartInfected ---Set isProstEquipped
---@param isIgnoredPartInfected boolean ---@param limbName string
function ModDataHandler:setIsIgnoredPartInfected(isIgnoredPartInfected) ---@param isProstEquipped boolean
self.tocData.isIgnoredPartInfected = isIgnoredPartInfected function ModDataHandler:setIsProstEquipped(limbName, isProstEquipped)
self.tocData[limbName].isProstEquipped = isProstEquipped
end
---Set prostFactor
---@param limbName string
---@param prostFactor number
function ModDataHandler:setProstFactor(limbName, prostFactor)
self.tocData[limbName].prostFactor = prostFactor
end end
----------------- -----------------
@@ -105,6 +122,12 @@ function ModDataHandler:getIsAnyLimbCut()
return self.tocData.isAnyLimbCut return self.tocData.isAnyLimbCut
end end
---Get isIgnoredPartInfected
---@return boolean
function ModDataHandler:getIsIgnoredPartInfected()
return self.tocData.isIgnoredPartInfected
end
---Get isCut ---Get isCut
---@param limbName string ---@param limbName string
---@return boolean ---@return boolean
@@ -112,18 +135,27 @@ function ModDataHandler:getIsCut(limbName)
return self.tocData[limbName].isCut return self.tocData[limbName].isCut
end end
---Get isIgnoredPartInfected
---@return boolean
function ModDataHandler:getIsIgnoredPartInfected()
return self.tocData.isIgnoredPartInfected
end
---Get isVisible ---Get isVisible
---@param limbName string
---@return boolean ---@return boolean
function ModDataHandler:getIsVisible(limbName) function ModDataHandler:getIsVisible(limbName)
return self.tocData[limbName].isVisible return self.tocData[limbName].isVisible
end end
---Get isProstEquipped
---@param limbName string
---@return boolean
function ModDataHandler:getIsProstEquipped(limbName)
return self.tocData[limbName].isProstEquipped
end
---Get prostFactor
---@param limbName string
---@return number
function ModDataHandler:getProstFactor(limbName)
return self.tocData[limbName].getProstFactor
end
--* Limbs data handling *-- --* Limbs data handling *--
---Set a limb and its dependend limbs as cut ---Set a limb and its dependend limbs as cut
@@ -167,6 +199,8 @@ function ModDataHandler:setLimbParams(limbName, ampStatus, cicatrizationTime)
if ampStatus.isCicatrized ~= nil then limbData.isCicatrized = ampStatus.isCicatrized end if ampStatus.isCicatrized ~= nil then limbData.isCicatrized = ampStatus.isCicatrized end
if ampStatus.isCauterized ~= nil then limbData.isCauterized = ampStatus.isCauterized end if ampStatus.isCauterized ~= nil then limbData.isCauterized = ampStatus.isCauterized end
if ampStatus.isVisible ~= nil then limbData.isVisible = ampStatus.isVisible end if ampStatus.isVisible ~= nil then limbData.isVisible = ampStatus.isVisible end
if ampStatus.isProstEquipped ~= nil then limbData.isProstEquipped = ampStatus.isProstEquipped end
if ampStatus.prostFactor ~= nil then limbData.prostFactor = ampStatus.prostFactor end
if cicatrizationTime ~= nil then limbData.cicatrizationTime = cicatrizationTime end if cicatrizationTime ~= nil then limbData.cicatrizationTime = cicatrizationTime end
end end

View File

@@ -46,13 +46,14 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid
---@diagnostic disable-next-line: duplicate-set-field ---@diagnostic disable-next-line: duplicate-set-field
function ISClothingExtraAction:isValid() function ISClothingExtraAction:isValid()
local bodyLocation = self.item:getBodyLocation() 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, "TOC_ArmProst") then
return true isEquippable = true
else else
return ProsthesisHandler.CheckIfEquippable(bodyLocation) isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation)
end end
return isEquippable
end end

View File

@@ -0,0 +1,10 @@
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
local SurgeryHandler = {}
function SurgeryHandler.InstallProsthesis()
-- TODO Set stuff in mod data
end
return SurgeryHandler

View File

@@ -0,0 +1 @@
-- temp

View File

@@ -66,7 +66,7 @@ local CutLimbHandler = BaseHandler:derive("CutLimbHandler")
function CutLimbHandler:new(panel, bodyPart) function CutLimbHandler:new(panel, bodyPart)
local o = BaseHandler.new(self, panel, bodyPart) local o = BaseHandler.new(self, panel, bodyPart)
o.items.ITEMS = {} o.items.ITEMS = {}
o.limbName = BodyPartType.ToString(self.bodyPart:getType()) o.limbName = BodyPartType.ToString(bodyPart:getType())
TOC_DEBUG.print("init CutLimbHandler") TOC_DEBUG.print("init CutLimbHandler")
return o return o
end end

View File

@@ -24,6 +24,8 @@ end
---@param worldObjects any ---@param worldObjects any
---@param test any ---@param test any
local function AddOvenContextMenu(playerNum, context, worldObjects, test) local function AddOvenContextMenu(playerNum, context, worldObjects, test)
if test then return true end
local pl = getSpecificPlayer(playerNum) local pl = getSpecificPlayer(playerNum)
if not ModDataHandler.GetInstance():getIsAnyLimbCut() then return end if not ModDataHandler.GetInstance():getIsAnyLimbCut() then return end

View File

@@ -13,9 +13,9 @@ local function AddBodyLocationBefore(newLocation, moveToLocation)
end end
AddBodyLocationBefore("TOC_ArmRight", "Shoes") AddBodyLocationBefore("TOC_Arm_R", "Shoes")
AddBodyLocationBefore("TOC_ArmLeft", "Shoes") AddBodyLocationBefore("TOC_Arm_L", "Shoes")
AddBodyLocationBefore("TOC_ArmProstRight", "Shoes") AddBodyLocationBefore("TOC_ArmProst_R", "Shoes")
AddBodyLocationBefore("TOC_ArmProstLeft", "Shoes") AddBodyLocationBefore("TOC_ArmProst_L", "Shoes")

View File

@@ -1,4 +1,4 @@
---@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number } ---@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number, isProstEquipped : boolean, prostFactor : number}
---@alias tocModData {Hand_L : partData, ForeArm_L : partData, UpperArm_L : partData, Hand_R : partData, ForeArm_R : partData, UpperArm_R : partData, isIgnoredPartInfected : boolean, isAnyLimbCut : boolean} ---@alias tocModData {Hand_L : partData, ForeArm_L : partData, UpperArm_L : partData, Hand_R : partData, ForeArm_R : partData, UpperArm_R : partData, isIgnoredPartInfected : boolean, isAnyLimbCut : boolean}
--------------------------- ---------------------------

View File

@@ -12,7 +12,7 @@ module TOC
DisplayName = Amputated right hand, DisplayName = Amputated right hand,
ClothingItem = Amputation_Hand_R, ClothingItem = Amputation_Hand_R,
BodyLocation = TOC_ArmRight, BodyLocation = TOC_Arm_R,
Weight = 0, Weight = 0,
CombatSpeedModifier = 0.9, CombatSpeedModifier = 0.9,
@@ -32,7 +32,7 @@ module TOC
DisplayName = Amputated right forearm, DisplayName = Amputated right forearm,
ClothingItem = Amputation_ForeArm_R, ClothingItem = Amputation_ForeArm_R,
BodyLocation = TOC_ArmRight, BodyLocation = TOC_Arm_R,
Weight = 0, Weight = 0,
CombatSpeedModifier = 0.8, CombatSpeedModifier = 0.8,
@@ -51,7 +51,7 @@ module TOC
DisplayName = Amputated entire right arm, DisplayName = Amputated entire right arm,
ClothingItem = Amputation_UpperArm_R, ClothingItem = Amputation_UpperArm_R,
BodyLocation = TOC_ArmRight, BodyLocation = TOC_Arm_R,
BloodLocation = UpperArms;UpperBody, BloodLocation = UpperArms;UpperBody,
Weight = 0, Weight = 0,
CombatSpeedModifier = 0.7, CombatSpeedModifier = 0.7,
@@ -69,7 +69,7 @@ module TOC
DisplayName = Amputated left hand, DisplayName = Amputated left hand,
ClothingItem = Amputation_Hand_L, ClothingItem = Amputation_Hand_L,
BodyLocation = TOC_ArmLeft, BodyLocation = TOC_Arm_L,
Weight = 0, Weight = 0,
CombatSpeedModifier = 0.9, CombatSpeedModifier = 0.9,
@@ -88,7 +88,7 @@ module TOC
DisplayCategory = Amputation, DisplayCategory = Amputation,
DisplayName = Amputated left forearm, DisplayName = Amputated left forearm,
ClothingItem = Amputation_ForeArm_L, ClothingItem = Amputation_ForeArm_L,
BodyLocation = TOC_ArmLeft, BodyLocation = TOC_Arm_L,
Weight = 0, Weight = 0,
CombatSpeedModifier = 0.8, CombatSpeedModifier = 0.8,
@@ -107,7 +107,7 @@ module TOC
DisplayCategory = Amputation, DisplayCategory = Amputation,
DisplayName = Amputated entire left arm, DisplayName = Amputated entire left arm,
ClothingItem = Amputation_UpperArm_L, ClothingItem = Amputation_UpperArm_L,
BodyLocation = TOC_ArmLeft, BodyLocation = TOC_Arm_L,
Weight = 0, Weight = 0,
CombatSpeedModifier = 0.7, CombatSpeedModifier = 0.7,
@@ -129,7 +129,7 @@ module TOC
ClothingItemExtra = Prost_Hook_R, ClothingItemExtra = Prost_Hook_R,
ClothingItemExtraOption = InstallProstRight, ClothingItemExtraOption = InstallProstRight,
clothingExtraSubmenu = InstallProstLeft, clothingExtraSubmenu = InstallProstLeft,
BodyLocation = TOC_ArmProstLeft, BodyLocation = TOC_ArmProst_L,
Weight = 0, Weight = 0,
CombatSpeedModifier = 0.7, CombatSpeedModifier = 0.7,
BloodLocation = UpperArms;UpperBody, BloodLocation = UpperArms;UpperBody,
@@ -149,7 +149,7 @@ module TOC
ClothingItemExtra = Prost_Hook_L, ClothingItemExtra = Prost_Hook_L,
ClothingItemExtraOption = InstallProstLeft, ClothingItemExtraOption = InstallProstLeft,
clothingExtraSubmenu = InstallProstRight, clothingExtraSubmenu = InstallProstRight,
BodyLocation = TOC_ArmProstRight, BodyLocation = TOC_ArmProst_R,
Weight = 0, Weight = 0,
CombatSpeedModifier = 0.7, CombatSpeedModifier = 0.7,

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 KiB