diff --git a/media/lua/client/TOC_ModDataHandler.lua b/media/lua/client/TOC_ModDataHandler.lua index 4272ff3..d5b8a1b 100644 --- a/media/lua/client/TOC_ModDataHandler.lua +++ b/media/lua/client/TOC_ModDataHandler.lua @@ -38,24 +38,23 @@ function ModDataHandler:createData() end end ------- + +--* Limbs data handling *-- ---Set a limb and its dependend limbs as cut ---@param limbName string function ModDataHandler:setCutLimb(limbName, isOperated, isCicatrized, isCauterized) self:setLimbParams(limbName, true, false, isOperated, isCicatrized, isCauterized, false) - for i=1, #StaticData.LIMB_DEPENDENCIES.limbName do - local dependedLimbName = StaticData.LIMB_DEPENDENCIES.limbName[i] + for i=1, #StaticData.LIMB_DEPENDENCIES[limbName] do + local dependedLimbName = StaticData.LIMB_DEPENDENCIES[limbName][i] -- We don't care about isOperated, isCicatrized and isCauterized since this is depending on another limb self:setLimbParams(dependedLimbName, true, false, nil, nil, nil, true) end end - - ----Internal use only +---Internal use only, set a limb data ---@param limbName string ---@param isCut boolean? ---@param isInfected boolean? diff --git a/media/lua/client/TOC_StaticData.lua b/media/lua/client/TOC_StaticData.lua index 943910b..7d7e67c 100644 --- a/media/lua/client/TOC_StaticData.lua +++ b/media/lua/client/TOC_StaticData.lua @@ -3,22 +3,49 @@ local StaticData = {} StaticData.MOD_NAME = "TOC" ----@enum -StaticData.BP_STRINGS = { - RightHand = "RightHand", - RightLowerArm = "RightLowerArm", - RightUpperArm = "RightUpperArm", - LeftHand = "LeftHand", - LeftLowerArm = "LeftLowerArm", - LeftUpperArm = "LeftUpperArm" +StaticData.SIDES_STRINGS = { + Right = "Right", + Left = "Left" } --- Body Parts Strings --- StaticData.BP_STRINGS = { --- "RightHand", "RightLowerArm", "RightUpperArm", --- "LeftHand", "LeftLowerArm", "LeftUpperArm" --- } +StaticData.PARTS_STRINGS = { + Hand = "Hand", + LowerArm = "LowerArm", + UpperArm = "UpperArm" +} + + +-- Assembled BodyParts string +---@enum +StaticData.BP_STRINGS = {} +StaticData.LIMB_DEPENDENCIES = {} +StaticData.LIMB_CICATRIZATION_TIME = {} + +for i=1, #StaticData.SIDES_STRINGS do + local side = StaticData.PARTS_STRINGS[i] + for y=1, #StaticData.PARTS_STRINGS do + local part = StaticData.PARTS_STRINGS[y] + local assembledName = side .. part + + -- Assembled strings + StaticData.BP_STRINGS[assembledName] = assembledName + + -- Dependencies and cicatrization time + if part == StaticData.PARTS_STRINGS.Hand then + StaticData.LIMB_CICATRIZATION_TIME[assembledName] = 1700 + StaticData.LIMB_DEPENDENCIES[assembledName] = {} + elseif part == StaticData.PARTS_STRINGS.LowerArm then + StaticData.LIMB_CICATRIZATION_TIME[assembledName] = 1800 + StaticData.LIMB_DEPENDENCIES[assembledName] = {side .. StaticData.PARTS_STRINGS.Hand} + + elseif part == StaticData.PART_STRINGS.UpperArm then + StaticData.LIMB_CICATRIZATION_TIME[assembledName] = 2000 + StaticData.LIMB_DEPENDENCIES[assembledName] = {side .. StaticData.PARTS_STRINGS.Hand, side .. StaticData.PARTS_STRINGS.LowerArm} + end + end +end + -- Link a trait to a specific body part StaticData.TRAITS_BP = { @@ -28,17 +55,6 @@ StaticData.TRAITS_BP = { } -StaticData.LIMB_DEPENDENCIES = { - RightHand = {}, - RightLowerArm = {StaticData.BP_STRINGS.RightHand}, - RightUpperArm = {StaticData.BP_STRINGS.RightHand, StaticData.BP_STRINGS.RightLowerArm}, - - LeftHand = {}, - LeftLowerArm = {StaticData.BP_STRINGS.LeftHand}, - LeftUpperArm = {StaticData.BP_STRINGS.LeftHand, StaticData.BP_STRINGS.LeftLowerArm}, - -} - return StaticData