TOC_Update was broken since... I dunno

This commit is contained in:
Pao
2023-01-15 02:12:01 +01:00
parent d0abaed732
commit 6e213edf7a
3 changed files with 24 additions and 18 deletions

View File

@@ -14,17 +14,17 @@ function TryTocAction(_, part_name, action, surgeon, patient)
if not isServer() and not isClient() then if not isServer() and not isClient() then
if action == "Cut" then if action == "Cut" then
TocCutLocal(_, patient, patient, part_name) TocCutLocal(_, surgeon, surgeon, part_name)
elseif action == "Operate" then elseif action == "Operate" then
TocOperateLocal(_, patient, patient, part_name, false) TocOperateLocal(_, surgeon, surgeon, part_name, false)
elseif action == "Equip" then elseif action == "Equip" then
-- TODO finish this -- TODO finish this
local item local item
TocEquipProsthesisLocal(_, patient, surgeon, part_name) TocEquipProsthesisLocal(_, surgeon, surgeon, part_name)
elseif action == "Unequip" then elseif action == "Unequip" then
-- TODO finish this -- TODO finish this
local item local item
TocUnequipProsthesisLocal(_, patient, part_name) TocUnequipProsthesisLocal(_, surgeon, part_name)
end end
else else
@@ -39,6 +39,10 @@ function TryTocAction(_, part_name, action, surgeon, patient)
elseif action == "Operate" then elseif action == "Operate" then
AskCanOperateLimb(patient, part_name) AskCanOperateLimb(patient, part_name)
elseif action == "Equip" then elseif action == "Equip" then
--AskCanEquipProsthesis(patient, part_name, item) --AskCanEquipProsthesis(patient, part_name, item)
elseif action == "Unequip" then elseif action == "Unequip" then
@@ -68,19 +72,19 @@ end
-- end -- end
local function CheckIfCanBeOperated(modData) -- local function CheckIfCanBeOperated(modData)
if modData.TOC.RightHand.is_cut and not modData.TOC.RightHand.is_operated -- if modData.TOC.RightHand.is_cut and not modData.TOC.RightHand.is_operated
or modData.TOC.RightForearm.is_cut and not modData.TOC.RightForearm.is_operated -- or modData.TOC.RightForearm.is_cut and not modData.TOC.RightForearm.is_operated
or modData.TOC.RightArm.is_cut and not modData.TOC.RightArm.is_operated -- or modData.TOC.RightArm.is_cut and not modData.TOC.RightArm.is_operated
or modData.TOC.LeftHand.is_cut and not modData.TOC.LeftHand.is_operated -- or modData.TOC.LeftHand.is_cut and not modData.TOC.LeftHand.is_operated
or modData.TOC.LeftForearm.is_cut and not modData.TOC.LeftForearm.is_operated -- or modData.TOC.LeftForearm.is_cut and not modData.TOC.LeftForearm.is_operated
or modData.TOC.LeftArm.is_cut and not modData.TOC.LeftArm.is_operated then -- or modData.TOC.LeftArm.is_cut and not modData.TOC.LeftArm.is_operated then
return true -- return true
else -- else
return false -- return false
end -- end
end -- end
local function CloseAllMenus(player_index) local function CloseAllMenus(player_index)
local contextMenu = getPlayerContextMenu(player_index) local contextMenu = getPlayerContextMenu(player_index)

View File

@@ -167,7 +167,9 @@ local function OnClickTocDescUI(button, args)
local patient = args.patient local patient = args.patient
local surgeon = args.surgeon local surgeon = args.surgeon
if patient == nil then
patient = surgeon
end
-- Validate action -- Validate action
if args.option == "Cut" then if args.option == "Cut" then
TryTocAction(_, desc_ui.part_name, "Cut", surgeon, patient) TryTocAction(_, desc_ui.part_name, "Cut", surgeon, patient)

View File

@@ -215,7 +215,7 @@ function TheOnlyCure.UpdateEveryTenMinutes()
-- Updates the cicatrization timesssss -- Updates the cicatrization timesssss
for _, part_name in pairs(GetBodyParts()) do for _, part_name in pairs(GetBodyParts()) do
if toc_data[part_name].is_cut and toc_data[part_name].is_cicatrized then if toc_data[part_name].is_cut and not toc_data[part_name].is_cicatrized then
toc_data[part_name].cicatrization_time = toc_data[part_name].cicatrization_time - 1 -- TODO Make it more "dynamic" toc_data[part_name].cicatrization_time = toc_data[part_name].cicatrization_time - 1 -- TODO Make it more "dynamic"