From 6e213edf7a21e961e3112351fa76b8b50204804b Mon Sep 17 00:00:00 2001 From: Pao Date: Sun, 15 Jan 2023 02:12:01 +0100 Subject: [PATCH] TOC_Update was broken since... I dunno --- media/lua/client/TOC_ContextMenus.lua | 36 +++++++++++++++------------ media/lua/client/TOC_UI.lua | 4 ++- media/lua/client/TOC_Update.lua | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/media/lua/client/TOC_ContextMenus.lua b/media/lua/client/TOC_ContextMenus.lua index ea76d28..ade665e 100644 --- a/media/lua/client/TOC_ContextMenus.lua +++ b/media/lua/client/TOC_ContextMenus.lua @@ -14,17 +14,17 @@ function TryTocAction(_, part_name, action, surgeon, patient) if not isServer() and not isClient() then if action == "Cut" then - TocCutLocal(_, patient, patient, part_name) + TocCutLocal(_, surgeon, surgeon, part_name) elseif action == "Operate" then - TocOperateLocal(_, patient, patient, part_name, false) + TocOperateLocal(_, surgeon, surgeon, part_name, false) elseif action == "Equip" then -- TODO finish this local item - TocEquipProsthesisLocal(_, patient, surgeon, part_name) + TocEquipProsthesisLocal(_, surgeon, surgeon, part_name) elseif action == "Unequip" then -- TODO finish this local item - TocUnequipProsthesisLocal(_, patient, part_name) + TocUnequipProsthesisLocal(_, surgeon, part_name) end else @@ -39,6 +39,10 @@ function TryTocAction(_, part_name, action, surgeon, patient) elseif action == "Operate" then AskCanOperateLimb(patient, part_name) elseif action == "Equip" then + + + + --AskCanEquipProsthesis(patient, part_name, item) elseif action == "Unequip" then @@ -68,19 +72,19 @@ end -- end -local function CheckIfCanBeOperated(modData) - 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.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.LeftForearm.is_cut and not modData.TOC.LeftForearm.is_operated - or modData.TOC.LeftArm.is_cut and not modData.TOC.LeftArm.is_operated then - return true - else - return false - end +-- local function CheckIfCanBeOperated(modData) +-- 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.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.LeftForearm.is_cut and not modData.TOC.LeftForearm.is_operated +-- or modData.TOC.LeftArm.is_cut and not modData.TOC.LeftArm.is_operated then +-- return true +-- else +-- return false +-- end -end +-- end local function CloseAllMenus(player_index) local contextMenu = getPlayerContextMenu(player_index) diff --git a/media/lua/client/TOC_UI.lua b/media/lua/client/TOC_UI.lua index bdc3d19..cfa0fa3 100644 --- a/media/lua/client/TOC_UI.lua +++ b/media/lua/client/TOC_UI.lua @@ -167,7 +167,9 @@ local function OnClickTocDescUI(button, args) local patient = args.patient local surgeon = args.surgeon - + if patient == nil then + patient = surgeon + end -- Validate action if args.option == "Cut" then TryTocAction(_, desc_ui.part_name, "Cut", surgeon, patient) diff --git a/media/lua/client/TOC_Update.lua b/media/lua/client/TOC_Update.lua index cde99e2..16ff5be 100644 --- a/media/lua/client/TOC_Update.lua +++ b/media/lua/client/TOC_Update.lua @@ -215,7 +215,7 @@ function TheOnlyCure.UpdateEveryTenMinutes() -- Updates the cicatrization timesssss 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"