From e6313cbfb9e07c523b2aef5f5b1c64686822927c Mon Sep 17 00:00:00 2001 From: Pao Date: Wed, 18 Jan 2023 00:33:56 +0100 Subject: [PATCH] Starting refactoring data stuff... help me --- media/lua/client/TOC_Test.lua | 107 +++++++++++++++++++++ media/lua/client/TOC_main.lua | 6 +- media/lua/client/Utils/UsefulFunctions.lua | 11 +++ 3 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 media/lua/client/TOC_Test.lua diff --git a/media/lua/client/TOC_Test.lua b/media/lua/client/TOC_Test.lua new file mode 100644 index 0000000..49ffa5e --- /dev/null +++ b/media/lua/client/TOC_Test.lua @@ -0,0 +1,107 @@ +-- TODO Rewrite how all prosthesis are handled + +function TestStuffToc() + + local mod_data = player:getModData().TOC + + mod_data.TOC = {} + + mod_data.TOC = { + + Limbs = {}, + Prosthesis = {}, + Generic = {}, + } + + + + + -------- + -- NEW NAMING SCHEME + + ---- Amputations + + -- Amputation_Left_Hand + -- Amputation_Right_UpperArm + + + ---- Prosthesis to equip + -- Prost_Left_Hand_MetalHook + -- Prost_Right_Forearm_WoodenHook + + --- Objects + -- Prost_Object_WoddenHook + + + local sides = {"Left", "Right"} + local limbs = {"Hand", "LowerArm", "UpperArm"} -- Let's follow their naming + + + + + + + + + + + + -- Setup prosthesis table + + local prosthesis_table = { + } + + + + + + for _ ,v in pairs(GetBodyParts()) do + mod_data.TOC.Limbs[v].is_cut = false + mod_data.TOC.Limbs[v].is_infected = false + mod_data.TOC.Limbs[v].is_operated = false + mod_data.TOC.Limbs[v].is_cicatrized = false + mod_data.TOC.Limbs[v].is_cauterized = false + mod_data.TOC.Limbs[v].is_amputation_shown = false + + mod_data.TOC.Limbs[v].cicatrization_time = 0 + + + mod_data.TOC.Limbs[v].is_prosthesis_equipped = false + mod_data.TOC.Limbs[v].prosthesis_factor = 1.0 + mod_data.TOC.Limbs[v].prosthesis_material_id = nil + + + -- Prosthesis part + mod_data.TOC.Prosthesis[v].accepted_prosthesis = {} + mod_data.TOC.Prosthesis + + + + end + + + mod_data.TOC.Prosthesis.list = GetProsthesisList() + + for _,v in ipairs(GetProsthesisLisHumanReadable()) do + mod_data.TOC.Prosthesis[v]. + + + + end + + + + + RightHand = {}, + RightForearm = {}, + RightArm = {}, + + LeftHand = {}, + LeftForearm = {}, + LeftArm = {}, + + is_other_bodypart_infected = false + } + + +end \ No newline at end of file diff --git a/media/lua/client/TOC_main.lua b/media/lua/client/TOC_main.lua index 89768d7..8856c10 100644 --- a/media/lua/client/TOC_main.lua +++ b/media/lua/client/TOC_main.lua @@ -19,7 +19,7 @@ function TheOnlyCure.InitTheOnlyCure(_, player) if mod_data.TOC == nil then mod_data.TOC = {} - print("CREATING NEW TOC STUFF SINCE YOU JUST DIED") + print("CREATING NEW TOC STUF") local rightHand = "RightHand" local rightForearm = "RightForearm" @@ -56,8 +56,8 @@ function TheOnlyCure.InitTheOnlyCure(_, player) mod_data.TOC[v].is_prosthesis_equipped = false - mod_data.TOC[v].prosthesis_factor = 1.0 -- TODO Every prosthesis has the same... does this even make sense here? - mod_data.TOC[v].prothesis_material_id = nil + mod_data.TOC[v].prosthesis_factor = 1.0 + mod_data.TOC[v].prosthesis_material_id = nil end diff --git a/media/lua/client/Utils/UsefulFunctions.lua b/media/lua/client/Utils/UsefulFunctions.lua index 9f7575e..5866bc1 100644 --- a/media/lua/client/Utils/UsefulFunctions.lua +++ b/media/lua/client/Utils/UsefulFunctions.lua @@ -3,6 +3,17 @@ function GetBodyParts() return bodyparts end + +-- TODO Find a better name +function GetProsthesisLisHumanReadable() + return {"WoodenHook", "MetalHook", "MetalHand"} + +end + + + + + function GetProsthesisList() return {"TOC.WoodenHook", "TOC.MetalHook", "TOC.MetalHand"}