This commit is contained in:
Pao
2023-01-23 01:00:11 +01:00
parent 73fdbb11e0
commit b7effc0d62
3 changed files with 33 additions and 67 deletions

View File

@@ -1,7 +1,7 @@
-- CutLimb
-- TODO if TheONlyCure. triggers an errors
function TocCheckIfStillInfected(part_data)
if part_data == nil then
function TocCheckIfStillInfected(limbs_data)
if limbs_data == nil then
return
end
-- Check ALL body part types to check if the player is still gonna die
@@ -9,26 +9,26 @@ function TocCheckIfStillInfected(part_data)
for _, v in ipairs(GetBodyParts()) do
if part_data[v].is_infected then
if limbs_data[v].is_infected then
check = true
end
end
if part_data.is_other_bodypart_infected then
if limbs_data.is_other_bodypart_infected then
check = true
end
return check
end
function TocCureInfection(body_damage, part_data, part_name)
function TocCureInfection(body_damage, limbs_data, part_name)
local body_part_type = body_damage:getBodyPart(TocGetBodyPartTypeFromPartName(part_name))
-- Check if we can heal the infection
local is_other_bodypart_infected = getPlayer():getModData().TOC.Limbs.is_other_bodypart_infected
if not is_other_bodypart_infected and not TheOnlyCure.CheckIfOtherLimbsAreInfected(part_data, part_name) then
if not is_other_bodypart_infected and not TheOnlyCure.CheckIfOtherLimbsAreInfected(limbs_data, part_name) then
body_damage:setInfected(false)
body_part_type:SetInfected(false)
body_damage:setInfectionMortalityDuration(-1)
@@ -91,14 +91,14 @@ function TocGetSawInInventory(surgeon)
end
-- OperateLimb
function SetBodyPartsStatusAfterOperation(player, part_data, part_name, use_oven)
function SetBodyPartsStatusAfterOperation(player, limbs_data, part_name, use_oven)
--for _, v in ipairs(GetBodyParts()) do
local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))
FixSingleBodyPartType(body_part_type, use_oven)
for _, v in ipairs(part_data[part_name].depends_on) do
for _, v in ipairs(limbs_data[part_name].depends_on) do
local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(v))
FixSingleBodyPartType(depended_body_part_type, use_oven)
@@ -169,37 +169,6 @@ function CheckIfItemIsAmputatedLimb(item)
end
-- function CheckIfItemIsAmputatedLimb(item)
-- local item_full_type = item:getFullType()
-- local sides = {"Left", "Right"}
-- local limbs_to_check = {"Hand", "LowerArm", "UpperArm"}
-- local is_amputated_limb = false
-- for _, part in ipairs(limbs_to_check) do
-- for _, side in ipairs(sides) do
-- local part_name = side .. "_" .. part
-- local check_name = "TOC.Amputation_" .. part_name
-- print(check_name)
-- if item_full_type == check_name then
-- is_amputated_limb = true
-- break
-- end
-- end
-- end
-- return is_amputated_limb
-- end
function CheckIfItemIsProsthesis(item)
-- TODO find a cleaner way