From 2606f664bcf649b402cf030b008db3f7234f979b Mon Sep 17 00:00:00 2001 From: ZioPao Date: Fri, 22 Dec 2023 23:04:36 -0500 Subject: [PATCH] Fixes to extra equip and recipes --- .gitignore | 1 + .vscode/settings.json | 2 +- .../client/TOC/Handlers/ProsthesisHandler.lua | 28 +++++++------ media/lua/shared/Translate/EN/Recipes_EN.txt | 4 ++ media/scripts/TOC_amputation_items.txt | 41 ------------------- media/scripts/TOC_recipes.txt | 38 ++++++++--------- 6 files changed, 38 insertions(+), 76 deletions(-) create mode 100644 media/lua/shared/Translate/EN/Recipes_EN.txt diff --git a/.gitignore b/.gitignore index e69de29..c6f9a44 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +.vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json index df66050..9d3a1e4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "todo-tree.tree.scanMode": "workspace", "zomboid_user_folder": "C:/Users/picch/Zomboid", - "zomboid_folder": "E:\\Steam\\steamapps\\common\\ProjectZomboid", + "zomboid_folder": "C:\\Program Files (x86)\\Steam\\steamapps\\common\\ProjectZomboid", "zomboid_server_folder": "E:\\Steam\\steamapps\\common\\Project Zomboid Dedicated Server", "Lua.diagnostics.globals": [ "ModOptions", diff --git a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua index d8c954a..b0da527 100644 --- a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua +++ b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua @@ -88,6 +88,8 @@ end local og_ISWearClothing_isValid = ISWearClothing.isValid function ISWearClothing:isValid() local isEquippable = og_ISWearClothing_isValid(self) + + -- TODO Do we actually need this? local isProst = ProsthesisHandler.CheckIfProst(self.item) if not isProst then return isEquippable end @@ -111,27 +113,29 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid ---@diagnostic disable-next-line: duplicate-set-field function ISClothingExtraAction:isValid() local isEquippable = og_ISClothingExtraAction_isValid(self) - local isProst = ProsthesisHandler.CheckIfProst(self.itemExtra) + --the item that we gets is the OG one, so if we're coming from the left one and wanna switch to the right one we're still gonna get the Left bodylocation + local testItem = InventoryItemFactory.CreateItem(self.extra) + local isProst = ProsthesisHandler.CheckIfProst(testItem) + + -- Early exit if it's not a prostheesis if not isProst then return isEquippable end - --the item that we gets is the OG one, so if we're coming from the left one and wanna switch to the right one we're still gonna get the Left bodylocation - local testItem = InventoryItemFactory.CreateItem(self.extra) - local bodyLocation = testItem:getBodyLocation() - if isEquippable and string.contains(bodyLocation, bodyLocArmProst) then + if isEquippable and isProst then + local bodyLocation = testItem:getBodyLocation() isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation) + + -- Just to let the player know + if not isEquippable then + -- TODO if its in here then it's gonna run at least 2 times + getPlayer():Say(getText("UI_Say_CantEquip")) + end + end return isEquippable end -local og_ISClothingExtraAction_stop = ISClothingExtraAction.stop -function ISClothingExtraAction:stop() - og_ISClothingExtraAction_stop(self) - if ProsthesisHandler.CheckIfProst(self.item) then - getPlayer():Say(getText("UI_Say_CantEquip")) - end -end local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform function ISClothingExtraAction:perform() diff --git a/media/lua/shared/Translate/EN/Recipes_EN.txt b/media/lua/shared/Translate/EN/Recipes_EN.txt new file mode 100644 index 0000000..50ea2e2 --- /dev/null +++ b/media/lua/shared/Translate/EN/Recipes_EN.txt @@ -0,0 +1,4 @@ +Recipes_EN = { + Recipe_Craft_Prosthetic_Arm = "Craft Prosthetic Arm", + Recipe_Craft_Prosthetic_Hook = "Craft Prosthetic Hook", +} \ No newline at end of file diff --git a/media/scripts/TOC_amputation_items.txt b/media/scripts/TOC_amputation_items.txt index 6085003..421b249 100644 --- a/media/scripts/TOC_amputation_items.txt +++ b/media/scripts/TOC_amputation_items.txt @@ -118,46 +118,5 @@ module TOC Icon = genericAmputation, CanHaveHoles = false, } - /****************** Clothing that look like a cut limb ******************/ - item Prost_Hook_L - { - Type = Clothing, - DisplayCategory = Prosthesis, - DisplayName = ProstArmHook, - ClothingItem = Prost_Hook_L, - ClothingItemExtra = Prost_Hook_R, - ClothingItemExtraOption = InstallProstRight, - clothingExtraSubmenu = InstallProstLeft, - BodyLocation = TOC_ArmProst_L, - Weight = 0, - CombatSpeedModifier = 0.7, - BloodLocation = UpperArms;UpperBody, - Insulation = 1.0, - WindResistance = 1.0, - WaterResistance = 1.0, - Icon = genericAmputation, - CanHaveHoles = false, - } - - item Prost_Hook_R - { - Type = Clothing, - DisplayCategory = Prosthesis, - DisplayName = ProstArmHook, - ClothingItem = Prost_Hook_R, - ClothingItemExtra = Prost_Hook_L, - ClothingItemExtraOption = InstallProstLeft, - clothingExtraSubmenu = InstallProstRight, - BodyLocation = TOC_ArmProst_R, - - Weight = 0, - CombatSpeedModifier = 0.7, - BloodLocation = UpperArms;UpperBody, - Insulation = 1.0, - WindResistance = 1.0, - WaterResistance = 1.0, - Icon = genericAmputation, - CanHaveHoles = false, - } } \ No newline at end of file diff --git a/media/scripts/TOC_recipes.txt b/media/scripts/TOC_recipes.txt index 554c4d3..dfdea94 100644 --- a/media/scripts/TOC_recipes.txt +++ b/media/scripts/TOC_recipes.txt @@ -7,33 +7,27 @@ module TOC /*************Craft Prosthetics*******************/ recipe Craft Prosthetic Arm { - ProstPart_WoodenBase, - ProstPart_WoodenHook, + MetalPipe=4, + Plank=2, + keep [Recipe.GetItemTypes.WeldingMask], - Time: 10.0, - Result: Prost_NormalArm_L, - NeedToBeLearn: true, - CanBeDoneFromFloor: false, - OnGiveXP: NoXP_OnGiveXP, - SkillRequired: FirstAid=2, - Category: Surgeon, - OnCreate:ProsthesisRecipes.OnCreateProsthesis, - Tooltip: Recipe_Tooltip_AssembleProsthesis, + Result:Prost_NormalArm_L, + Time:150.0, + Category:Welding, + OnGiveXP:Recipe.OnGiveXP.MetalWelding10, + NeedToBeLearn:true, } recipe Craft Prosthetic Hook { - ProstPart_WoodenBase, - ProstPart_WoodenHook, + MetalPipe=2, + Plank=2, + keep [Recipe.GetItemTypes.WeldingMask], - Time: 10.0, - Result: Prost_HookArm_L, - NeedToBeLearn: true, - CanBeDoneFromFloor: false, - OnGiveXP: NoXP_OnGiveXP, - SkillRequired: FirstAid=2, - Category: Surgeon, - OnCreate:ProsthesisRecipes.OnCreateProsthesis, - Tooltip: Recipe_Tooltip_AssembleProsthesis, + Result:Prost_HookArm_L, + Time:150.0, + Category:Welding, + OnGiveXP:Recipe.OnGiveXP.MetalWelding10, + NeedToBeLearn:false, } } \ No newline at end of file