From 18ceeb0cb5bd459d76dd570203fae57ecb39dfa5 Mon Sep 17 00:00:00 2001 From: Pao Date: Mon, 30 Jan 2023 18:07:39 +0100 Subject: [PATCH] Basic Fix for traits --- media/lua/client/TOC_Debug.lua | 8 ++++++++ media/lua/client/TOC_main.lua | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/media/lua/client/TOC_Debug.lua b/media/lua/client/TOC_Debug.lua index d508048..f2ada04 100644 --- a/media/lua/client/TOC_Debug.lua +++ b/media/lua/client/TOC_Debug.lua @@ -4,6 +4,14 @@ function TocResetEverything() local player_inventory = player:getInventory() local mod_data = player:getModData() mod_data.TOC = nil + + -- Removes traits just to be sure + local toc_traits = player:getTraits() + toc_traits:remove("Amputee_Hand") + toc_traits:remove("Amputee_LowerArm") + toc_traits:remove("Amputee_UpperArm") + + TheOnlyCure.InitTheOnlyCure(_, player) -- Destroy the amputation or prosthesis item diff --git a/media/lua/client/TOC_main.lua b/media/lua/client/TOC_main.lua index 5970bac..8d5f314 100644 --- a/media/lua/client/TOC_main.lua +++ b/media/lua/client/TOC_main.lua @@ -148,6 +148,13 @@ function TocSetInitData(mod_data, player) mod_data.TOC.Limbs.Left_LowerArm.is_operated = true mod_data.TOC.Limbs.Left_LowerArm.is_amputation_shown = true mod_data.TOC.Limbs.Left_LowerArm.is_cicatrized = true + + for _, v in pairs(mod_data.TOC.Limbs.Left_LowerArm.depends_on) do + mod_data.TOC.Limbs[v].is_cut = true + mod_data.TOC.Limbs[v].is_operated = true + mod_data.TOC.Limbs[v].is_amputation_shown = false + mod_data.TOC.Limbs[v].is_cicatrized = true + end elseif player:HasTrait("Amputee_UpperArm") then local amputation_clothing_item = player:getInventory():AddItem("TOC.Amputation_Left_UpperArm") TocSetCorrectTextureForAmputation(amputation_clothing_item, player) @@ -157,6 +164,13 @@ function TocSetInitData(mod_data, player) mod_data.TOC.Limbs.Left_UpperArm.is_operated = true mod_data.TOC.Limbs.Left_UpperArm.is_amputation_shown = true mod_data.TOC.Limbs.Left_UpperArm.is_cicatrized = true + + for _, v in pairs(mod_data.TOC.Limbs.Left_UpperArm.depends_on) do + mod_data.TOC.Limbs[v].is_cut = true + mod_data.TOC.Limbs[v].is_operated = true + mod_data.TOC.Limbs[v].is_amputation_shown = false + mod_data.TOC.Limbs[v].is_cicatrized = true + end end