replacing ipairs with pairs

This commit is contained in:
Pao
2023-02-11 22:00:53 +01:00
parent 3ea76e8834
commit bd87cd7777
9 changed files with 22 additions and 28 deletions

View File

@@ -11,7 +11,7 @@ local function TocCheckIfStillInfected(limbs_data)
local check = false
for _, v in ipairs(GetBodyParts()) do
for _, v in pairs(GetBodyParts()) do
if limbs_data[v].is_infected then
check = true
end
@@ -37,8 +37,8 @@ local function TocCureInfection(body_damage, part_name)
-- TODO I think this is enough... we should just cycle if with everything instead of that crap up there
for i = body_part_types:size() - 1, 0, -1 do
local bodyPart = body_part_types:get(i);
bodyPart:SetInfected(false);
local bodyPart = body_part_types:get(i)
bodyPart:SetInfected(false)
end
if body_part_type:scratched() then body_part_type:setScratched(false, false) end

View File

@@ -20,13 +20,10 @@ local function FixSingleBodyPartType(body_part_type, use_oven)
end
local function SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_oven)
--for _, v in ipairs(GetBodyParts()) do
local body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(part_name))
FixSingleBodyPartType(body_part_type, use_oven)
for _, v in ipairs(limbs_data[part_name].depends_on) do
for _, v in pairs(limbs_data[part_name].depends_on) do
local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(v))
FixSingleBodyPartType(depended_body_part_type, use_oven)