From 639841cf204025d09bda3cc3c779e6902e27e47f Mon Sep 17 00:00:00 2001 From: ZioPao Date: Sun, 24 Mar 2024 22:30:04 +0100 Subject: [PATCH] Add explicit support for brutal handwork --- media/lua/client/TOC/Compat.lua | 15 ++++++++++++ .../CutLimbInteractionHandler.lua | 24 ++++++++++++++++++- media/lua/shared/TOC/StaticData.lua | 3 +++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 media/lua/client/TOC/Compat.lua diff --git a/media/lua/client/TOC/Compat.lua b/media/lua/client/TOC/Compat.lua new file mode 100644 index 0000000..ce3da20 --- /dev/null +++ b/media/lua/client/TOC/Compat.lua @@ -0,0 +1,15 @@ + +--* BRUTAL HANDS -- * + +local function HandleModCompatibility() + + if getActivatedMods():contains('BrutalHandwork') then + BrutalHands = BrutalHands or {} + BrutalHands.TOC = require("TOC/API") + + -- Brutal hands has a TOC_COMPAT but its check is wrong and uses an old API. + end +end + +Events.OnGameStart.Add(HandleModCompatibility) + diff --git a/media/lua/client/TOC/UI/Interactions/CutLimbInteractionHandler.lua b/media/lua/client/TOC/UI/Interactions/CutLimbInteractionHandler.lua index d6f9937..fb79856 100644 --- a/media/lua/client/TOC/UI/Interactions/CutLimbInteractionHandler.lua +++ b/media/lua/client/TOC/UI/Interactions/CutLimbInteractionHandler.lua @@ -106,9 +106,31 @@ local function AddInvAmputationOptions(player, context, sawItem, stitchesItem, b local subMenu = context:getNew(context) context:addSubMenu(option, subMenu) + + + -- TODO Separate into groups + + + -- Amputate -> Top/Bottom - > Left/Right - > Limb + -- for i=1, #StaticData.PROSTHESES_GROUPS_STR do + -- local group = StaticData.PROSTHESES_GROUPS_STR[i] + + -- for j=1, #StaticData.SIDES_IND_STR do + + -- end + + -- end + + -- for k,v in pairs(StaticData.LIMBS_TO_PROST_GROUP_MATCH_IND_STR) do + -- TOC_DEBUG.print(k) + + -- end + + + local dc = DataController.GetInstance() for i = 1, #StaticData.LIMBS_STR do local limbName = StaticData.LIMBS_STR[i] - if not DataController.GetInstance():getIsCut(limbName) then + if not dc:getIsCut(limbName) then local limbTranslatedName = getText("ContextMenu_Limb_" .. limbName) subMenu:addOption(limbTranslatedName, player, PerformAction, player, limbName, sawItem, stitchesItem, bandageItem) end diff --git a/media/lua/shared/TOC/StaticData.lua b/media/lua/shared/TOC/StaticData.lua index 9156001..03f249f 100644 --- a/media/lua/shared/TOC/StaticData.lua +++ b/media/lua/shared/TOC/StaticData.lua @@ -29,6 +29,9 @@ StaticData.SIDES_IND_STR = { R = "R", L = "L" } +StaticData.SIDES_STR = { + "R", "L" +} StaticData.PARTS_IND_STR = { Hand = "Hand", ForeArm = "ForeArm",