From b783e055767f63dfe6b08571e841a56b350fd5ab Mon Sep 17 00:00:00 2001 From: Pao Date: Wed, 18 Jan 2023 21:14:43 +0100 Subject: [PATCH] Some more fixes post rewrite --- media/lua/client/TOC_Checks.lua | 36 ++++++++++++++++------ media/lua/client/TOC_ContextMenus.lua | 2 +- media/lua/client/TOC_UI.lua | 7 +++++ media/lua/shared/translate/EN/IG_UI_EN.txt | 2 +- media/perks.txt | 16 +++++----- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/media/lua/client/TOC_Checks.lua b/media/lua/client/TOC_Checks.lua index dc858df..cc9359a 100644 --- a/media/lua/client/TOC_Checks.lua +++ b/media/lua/client/TOC_Checks.lua @@ -4,12 +4,37 @@ if TheOnlyCure == nil then TheOnlyCure = {} end +----------------------------------------- +-- MP HANDLING CHECKS function CheckIfCanBeCut(part_name) -- This is just for MP handling... Not enough to check everything - return not getPlayer():getModData().TOC.Limbs[part_name].is_cut + + local toc_data = getPlayer():getModData().TOC + local check = (not toc_data.Limbs[part_name].is_cut) and (not CheckIfProsthesisAlreadyInstalled(toc_data.Limbs, part_name)) + + return check end + + +function CheckIfCanBeOperated(part_name) + + local part_data = getPlayer():getModData().TOC.Limbs + + return part_data[part_name].is_operated == false and part_data[part_name].is_amputation_shown + +end + +function CheckIfProsthesisCanBeEquipped(part_name) + +end + +------------------------------- + + + + function CheckIfProsthesisAlreadyInstalled(part_data, part_name) local r = "Right" @@ -28,14 +53,5 @@ function CheckIfProsthesisAlreadyInstalled(part_data, part_name) end -function CheckIfCanBeOperated(part_name) - local part_data = getPlayer():getModData().TOC.Limbs - return part_data[part_name].is_operated == false and part_data[part_name].is_amputation_shown - -end - -function CheckIfProsthesisCanBeEquipped(part_name) - -end \ No newline at end of file diff --git a/media/lua/client/TOC_ContextMenus.lua b/media/lua/client/TOC_ContextMenus.lua index 931e909..8a56add 100644 --- a/media/lua/client/TOC_ContextMenus.lua +++ b/media/lua/client/TOC_ContextMenus.lua @@ -131,7 +131,7 @@ TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, if local_player == clicked_player then -- Local player - if CheckIfCanBeCut(v) and not CheckIfProsthesisAlreadyInstalled(local_part_data, v) then + if CheckIfCanBeCut(v) then cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Cut", local_player, local_player) elseif CheckIfCanBeOperated(v) then diff --git a/media/lua/client/TOC_UI.lua b/media/lua/client/TOC_UI.lua index 5aae821..fc16909 100644 --- a/media/lua/client/TOC_UI.lua +++ b/media/lua/client/TOC_UI.lua @@ -454,6 +454,13 @@ function SetupTocDescUI(surgeon, patient, toc_data, part_name) desc_ui["b1"]:setVisible(false) end + else + desc_ui["status"]:setText("Not cut") + desc_ui["status"]:setColor(1, 1, 1, 1) + desc_ui["b1"]:setVisible(true) + desc_ui["b1"]:setText("Remove prosthesis before") + desc_ui["b1"]:addArg("option", "Nothing") + end -- Prosthesis Level diff --git a/media/lua/shared/translate/EN/IG_UI_EN.txt b/media/lua/shared/translate/EN/IG_UI_EN.txt index a09800d..e7950f8 100644 --- a/media/lua/shared/translate/EN/IG_UI_EN.txt +++ b/media/lua/shared/translate/EN/IG_UI_EN.txt @@ -14,5 +14,5 @@ IGUI_EN = { IGUI_perks_Right_Hand = "Right hand", IGUI_perks_Left_Hand = "Left hand", - IGUI_perks_Prosthesis_Skill_desc = "Prosthesis skills", + IGUI_perks_Prosthesis = "Prosthesis skills", } \ No newline at end of file diff --git a/media/perks.txt b/media/perks.txt index 3cb4ec3..c965553 100644 --- a/media/perks.txt +++ b/media/perks.txt @@ -1,9 +1,9 @@ VERSION = 1, -perk Protheses +perk Prosthesis { parent = None, - translation = Protheses, + translation = Prosthesis, passive = false, xp1 = 0, xp2 = 0, @@ -19,9 +19,9 @@ perk Protheses perk Left_Hand { - parent = Protheses, - name = LeftHand, - translation = LeftHand, + parent = Prosthesis, + name = Left_Hand, + translation = Left_Hand, passive = false, xp1 = 50, xp2 = 100, @@ -37,9 +37,9 @@ perk Left_Hand perk Right_Hand { - parent = Protheses, - name = RightHand, - translation = RightHand, + parent = Prosthesis, + name = Right_Hand, + translation = Right_Hand, passive = false, xp1 = 50, xp2 = 100,