Files
The-Only-Cure/media/lua/client/TOC_Checks.lua
Pao 79fd46a808 - Fixed some MP checks
- New prost for lower arm males
2023-01-26 21:46:50 +01:00

69 lines
1.6 KiB
Lua

-- VARIOUS CHECKS --
if TheOnlyCure == nil then
TheOnlyCure = {}
end
-----------------------------------------
-- MP HANDLING CHECKS
function CheckIfCanBeCut(part_name, limbs_data)
if limbs_data == nil then
limbs_data = getPlayer():getModData().TOC.Limbs
end
local check = (not limbs_data[part_name].is_cut) and
(not CheckIfProsthesisAlreadyInstalled(limbs_data, part_name))
return check
end
function CheckIfCanBeOperated(part_name, limbs_data)
if limbs_data == nil then
limbs_data = getPlayer():getModData().TOC.Limbs
end
return limbs_data[part_name].is_operated == false and limbs_data[part_name].is_amputation_shown
end
function CheckIfProsthesisCanBeEquipped(part_name)
local limbs_data = getPlayer():getModData().TOC.Limbs
return limbs_data[part_name].is_cauterized or limbs_data[part_name].is_cicatrized
-- check if prosthesis is in the surgeon inventory... we need to get it before
end
function CheckIfProsthesisCanBeUnequipped(part_name)
-- TODO we should get item here to be sure that we can do this action instead of relying on some later checks
return true
end
-------------------------------
function CheckIfProsthesisAlreadyInstalled(limbs_data, part_name)
local r = "Right"
local l = "Left"
if string.find(part_name, r) then
return (limbs_data[r .. "_Hand"].is_prosthesis_equipped or limbs_data[r .. "_LowerArm"].is_prosthesis_equipped)
elseif string.find(part_name, l) then
return (limbs_data[l .. "_Hand"].is_prosthesis_equipped or limbs_data[l .. "_LowerArm"].is_prosthesis_equipped)
end
end