From 031af29b519f288b11ae440a4a5dd27f6b04ec9e Mon Sep 17 00:00:00 2001 From: Pao Date: Fri, 10 Feb 2023 04:10:06 +0100 Subject: [PATCH] I'm a dum dum and my brain no work --- .../ActionsMethods/TOC_ProsthesisMethods.lua | 4 + media/lua/client/TOC_Compatibility.lua | 5 +- media/lua/client/TOC_Debug.lua | 10 ++ media/lua/client/TOC_ProsthesisHandler.lua | 92 +++++++++++++++++++ media/scripts/TOC_recipes.txt | 1 + 5 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 media/lua/client/TOC_ProsthesisHandler.lua diff --git a/media/lua/client/ActionsMethods/TOC_ProsthesisMethods.lua b/media/lua/client/ActionsMethods/TOC_ProsthesisMethods.lua index 56c4d81..96fbae8 100644 --- a/media/lua/client/ActionsMethods/TOC_ProsthesisMethods.lua +++ b/media/lua/client/ActionsMethods/TOC_ProsthesisMethods.lua @@ -8,6 +8,10 @@ ---@param part_name string ---@param prosthesis_base_name string function TocEquipProsthesis(part_name, prosthesis_base_name) + + -- TODO probably will have to move this from the TOC menu to classic equip to have dynamic durability + + local player = getPlayer() local toc_data = player:getModData().TOC diff --git a/media/lua/client/TOC_Compatibility.lua b/media/lua/client/TOC_Compatibility.lua index ab064ca..58a04d6 100644 --- a/media/lua/client/TOC_Compatibility.lua +++ b/media/lua/client/TOC_Compatibility.lua @@ -45,8 +45,9 @@ function TocCheckCompatibilityWithOlderVersions(mod_data) print("TOC: Something was wrongly initiliazed before. Resetting parameters") TocResetEverything() else - print("TOC: Found compatible data, correcting models in case of errors and adding limbs") - TocReapplyAmputationClothingItem(mod_data) + print("TOC: Bypassing reapplying of amputations, assuming that everything is correct") + --print("TOC: Found compatible data, correcting models in case of errors and adding limbs") + --TocReapplyAmputationClothingItem(mod_data) end end diff --git a/media/lua/client/TOC_Debug.lua b/media/lua/client/TOC_Debug.lua index 3979a77..376f25b 100644 --- a/media/lua/client/TOC_Debug.lua +++ b/media/lua/client/TOC_Debug.lua @@ -137,4 +137,14 @@ function TocTestBodyLocations() print(list:get(i -1):getId()) end +end + +function TocTestItem() + local player = getPlayer() + local player_inventory = player:getInventory() + local item_name = "TOC.Amputation_" .. "Right" .. "_" .. "Hand" + local found_item = player_inventory:FindAndReturn(item_name) + + print(found_item:getID()) + end \ No newline at end of file diff --git a/media/lua/client/TOC_ProsthesisHandler.lua b/media/lua/client/TOC_ProsthesisHandler.lua new file mode 100644 index 0000000..f64b4b3 --- /dev/null +++ b/media/lua/client/TOC_ProsthesisHandler.lua @@ -0,0 +1,92 @@ +local BaseStats = { + LeatherBase = { + durability = 25, + speed = 15 + }, + WoodenBase = { + durability = 10, + speed = 5, + }, + MetalBase = { + durability = 75, + speed = 7, + } + + + + +} + + +local TopStats = { + +} + + + + + + + +function GenerateEquippedProsthesis(prosthesis_item) + -- TODO Durability should be decided from the clothing item xml. Same thing for disassembling stuff + + local durability = 0 + local speed = 0 + + local prosthesis_name = prosthesis_item:getFullType() + + for base_name, base_values in pairs(BaseStats) do + -- Check the name of the prosthesis item, set the correct values + if string.find(prosthesis_name, base_name) then + durability = base_values.durability + speed = base_values.speed + end + end + + + + for top_name, top_values in pairs(TopStats) do + -- Check the name of the prosthesis item, set the correct values + if string.find(prosthesis_name, top_name) then + durability = durability + top_values.durability + speed = speed + top_values.speed + end + end + + -- TODO This won't work since if we unequip it we would lose this stuff. We need to bind it to the item + local prosthesis_table = { + prost_id = prosthesis_item:getID(), + prost_name = prosthesis_name, + durability = durability, + speed = speed + } + + + return prosthesis_table +end + +local ProsthesisRecipe = {} + + +function ProsthesisRecipe.OnCreate.Hook(items, result, player, selectedItem) + + -- Set mod data for item with durability and all that crap + + + -- when we equip a prosthesis, we're gonna pass these parameters to the newly generated clothing item + + -- when we unequip it, we regen the normal item with the parameters from the clothing item + + +end + + + + +function DoWeReallyNeedThis() + + -- We need a durability check... so in modData + + -- +end \ No newline at end of file diff --git a/media/scripts/TOC_recipes.txt b/media/scripts/TOC_recipes.txt index 25a94d7..9f3cc3f 100644 --- a/media/scripts/TOC_recipes.txt +++ b/media/scripts/TOC_recipes.txt @@ -82,6 +82,7 @@ recipe Make wooden hook Category: Surgeon, Tooltip: Recipe_Tooltip_Wooden_hook, NeedToBeLearn: true, + OnCreate: ProsthesisRecipe.OnCreate.Hook, } recipe Make metal hook