Redone staticdata

This commit is contained in:
ZioPao
2023-11-06 11:28:47 +01:00
parent fcc30e3314
commit f39bc5c36e
2 changed files with 45 additions and 30 deletions

View File

@@ -38,24 +38,23 @@ function ModDataHandler:createData()
end end
end end
------
--* Limbs data handling *--
---Set a limb and its dependend limbs as cut ---Set a limb and its dependend limbs as cut
---@param limbName string ---@param limbName string
function ModDataHandler:setCutLimb(limbName, isOperated, isCicatrized, isCauterized) function ModDataHandler:setCutLimb(limbName, isOperated, isCicatrized, isCauterized)
self:setLimbParams(limbName, true, false, isOperated, isCicatrized, isCauterized, false) self:setLimbParams(limbName, true, false, isOperated, isCicatrized, isCauterized, false)
for i=1, #StaticData.LIMB_DEPENDENCIES.limbName do for i=1, #StaticData.LIMB_DEPENDENCIES[limbName] do
local dependedLimbName = StaticData.LIMB_DEPENDENCIES.limbName[i] local dependedLimbName = StaticData.LIMB_DEPENDENCIES[limbName][i]
-- We don't care about isOperated, isCicatrized and isCauterized since this is depending on another limb -- 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) self:setLimbParams(dependedLimbName, true, false, nil, nil, nil, true)
end end
end end
---Internal use only, set a limb data
---Internal use only
---@param limbName string ---@param limbName string
---@param isCut boolean? ---@param isCut boolean?
---@param isInfected boolean? ---@param isInfected boolean?

View File

@@ -3,22 +3,49 @@ local StaticData = {}
StaticData.MOD_NAME = "TOC" StaticData.MOD_NAME = "TOC"
---@enum
StaticData.BP_STRINGS = {
RightHand = "RightHand",
RightLowerArm = "RightLowerArm",
RightUpperArm = "RightUpperArm",
LeftHand = "LeftHand", StaticData.SIDES_STRINGS = {
LeftLowerArm = "LeftLowerArm", Right = "Right",
LeftUpperArm = "LeftUpperArm" Left = "Left"
} }
-- Body Parts Strings StaticData.PARTS_STRINGS = {
-- StaticData.BP_STRINGS = { Hand = "Hand",
-- "RightHand", "RightLowerArm", "RightUpperArm", LowerArm = "LowerArm",
-- "LeftHand", "LeftLowerArm", "LeftUpperArm" 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 -- Link a trait to a specific body part
StaticData.TRAITS_BP = { 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 return StaticData