cleaned naming for StaticData

This commit is contained in:
ZioPao
2023-11-14 10:20:58 +01:00
parent 81be27561d
commit 65795cbe79
8 changed files with 118 additions and 93 deletions

View File

@@ -76,7 +76,7 @@ function AmputationHandler:damageAfterAmputation(surgeonFactor)
local patientStats = self.patientPl:getStats()
local bd = self.patientPl:getBodyDamage()
local bodyPart = bd:getBodyPart(self.bodyPartType)
local baseDamage = StaticData.LIMBS_BASE_DAMAGE[self.limbName]
local baseDamage = StaticData.LIMBS_BASE_DAMAGE_IND_NUM[self.limbName]
bodyPart:AddDamage(baseDamage - surgeonFactor)
bodyPart:setAdditionalPain(baseDamage - surgeonFactor)

View File

@@ -22,8 +22,8 @@ CachedDataHandler.amputatedLimbs = {}
function CachedDataHandler.CalculateAmputatedLimbs(username)
CachedDataHandler.amputatedLimbs[username] = {}
local modDataHandler = ModDataHandler.GetInstance(username)
for i=1, #StaticData.LIMBS_STRINGS do
local limbName = StaticData.LIMBS_STRINGS[i]
for i=1, #StaticData.LIMBS_STR do
local limbName = StaticData.LIMBS_STR[i]
if modDataHandler:getIsCut(limbName) then
CachedDataHandler.AddAmputatedLimb(username, limbName)
end

View File

@@ -58,7 +58,7 @@ end
---@param limbName string
function ItemsHandler.DeleteOldAmputationItem(playerObj, limbName)
local side = CommonMethods.GetSide(limbName)
for partName, _ in pairs(StaticData.PARTS_STRINGS) do
for partName, _ in pairs(StaticData.PARTS_IND_STR) do
local othLimbName = partName .. "_" .. side
local othClothingItemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. othLimbName
@@ -76,8 +76,8 @@ end
---@param playerObj IsoPlayer
function ItemsHandler.DeleteAllOldAmputationItems(playerObj)
for i=1, #StaticData.LIMBS_STRINGS do
local limbName = StaticData.LIMBS_STRINGS[i]
for i=1, #StaticData.LIMBS_STR do
local limbName = StaticData.LIMBS_STR[i]
local clothItemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
local clothItem = playerObj:getInventory():FindAndReturn(clothItemName)
---@cast clothItem InventoryItem

View File

@@ -61,15 +61,15 @@ function ModDataHandler:setup(key)
-- Initialize limbs
for i=1, #StaticData.LIMBS_STRINGS do
local limbName = StaticData.LIMBS_STRINGS[i]
for i=1, #StaticData.LIMBS_STR do
local limbName = StaticData.LIMBS_STR[i]
self.tocData.limbs[limbName] = {}
self:setLimbParams(StaticData.LIMBS_STRINGS[i], defaultParams, 0)
self:setLimbParams(StaticData.LIMBS_STR[i], defaultParams, 0)
end
local prosthesesGroups = {"top", "bottom"}
for i=1, #prosthesesGroups do
local group = prosthesesGroups[i]
-- Initialize prostheses stuff
for i=1, #StaticData.PROSTHESES_GROUPS do
local group = StaticData.PROSTHESES_GROUPS[i]
self.tocData.prostheses[group] = {
isEquipped = false,
prostFactor = 0
@@ -181,15 +181,15 @@ end
function ModDataHandler:setCutLimb(limbName, isOperated, isCicatrized, isCauterized, surgeonFactor)
local cicatrizationTime = 0
if isCicatrized == false or isCauterized == false then
cicatrizationTime = StaticData.LIMBS_CICATRIZATION_TIME[limbName] - surgeonFactor
cicatrizationTime = StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[limbName] - surgeonFactor
end
---@type partData
local params = {isCut = true, isInfected = false, isOperated = isOperated, isCicatrized = isCicatrized, isCauterized = isCauterized, isVisible = true}
self:setLimbParams(limbName, params, cicatrizationTime)
for i=1, #StaticData.LIMBS_DEPENDENCIES[limbName] do
local dependedLimbName = StaticData.LIMBS_DEPENDENCIES[limbName][i]
for i=1, #StaticData.LIMBS_DEPENDENCIES_IND_STR[limbName] do
local dependedLimbName = StaticData.LIMBS_DEPENDENCIES_IND_STR[limbName][i]
-- We don't care about isOperated, isCicatrized, isCauterized since this is depending on another limb
-- Same story for cicatrizationTime, which will be 0
@@ -213,8 +213,6 @@ function ModDataHandler:setLimbParams(limbName, ampStatus, cicatrizationTime)
if ampStatus.isCicatrized ~= nil then limbData.isCicatrized = ampStatus.isCicatrized end
if ampStatus.isCauterized ~= nil then limbData.isCauterized = ampStatus.isCauterized 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
end

View File

@@ -64,9 +64,9 @@ function PlayerHandler.CheckInfection(character)
local bd = character:getBodyDamage()
local modDataHandler = ModDataHandler.GetInstance()
for i=1, #StaticData.LIMBS_STRINGS do
local limbName = StaticData.LIMBS_STRINGS[i]
local bptEnum = StaticData.BODYPARTSTYPES_ENUM[limbName]
for i=1, #StaticData.LIMBS_STR do
local limbName = StaticData.LIMBS_STR[i]
local bptEnum = StaticData.BODYLOCS_IND_BPT[limbName]
local bodyPart = bd:getBodyPart(bptEnum)
if bodyPart:bitten() or bodyPart:IsInfected() then
@@ -82,8 +82,8 @@ function PlayerHandler.CheckInfection(character)
-- We can skip this loop if the player has been infected. The one before we kinda need it to handle correctly the bites in case the player wanna cut stuff off anyway
if ModDataHandler.GetInstance():getIsIgnoredPartInfected() then return end
for i=1, #StaticData.IGNORED_PARTS_STRINGS do
local bodyPartType = BodyPartType[StaticData.IGNORED_PARTS_STRINGS[i]]
for i=1, #StaticData.IGNORED_BODYLOCS_IND_BPT do
local bodyPartType = StaticData.IGNORED_BODYLOCS_IND_BPT[i]
local bodyPart = bd:getBodyPart(bodyPartType)
if bodyPart and (bodyPart:bitten() or bodyPart:IsInfected()) then
ModDataHandler.GetInstance():setIsIgnoredPartInfected(true)
@@ -124,7 +124,7 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
local perkLevel = pl:getPerkLevel(perk)
local perkLevelScaled
if perkLevel ~= 0 then perkLevelScaled = perkLevel / 10 else perkLevelScaled = 0 end
time = time * (StaticData.LIMBS_TIME_MULTIPLIER[limbName] - perkLevelScaled)
time = time * (StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[limbName] - perkLevelScaled)
end
end
end
@@ -138,7 +138,7 @@ function ISBaseTimedAction:perform()
og_ISBaseTimedAction_perform(self)
if ModDataHandler.GetInstance():getIsAnyLimbCut() then
for side, _ in pairs(StaticData.SIDES_STRINGS) do
for side, _ in pairs(StaticData.SIDES_IND_STR) do
local limbName = "Hand_" .. side
if ModDataHandler.GetInstance():getIsCut(limbName) then
PlayerHandler.playerObj:getXp():AddXP(Perks["Side_" .. side], 2) -- TODO Make it dynamic

View File

@@ -7,7 +7,7 @@ local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
---@class ProsthesisHandler
local ProsthesisHandler = {}
local bodyLocArmProst = StaticData.BODYLOCATIONS_BASE_STRINGS.TOC_ArmProst
local bodyLocArmProst = StaticData.MOD_BODYLOCS_BASE_IND_STR.TOC_ArmProst
---comment
---@param item InventoryItem