diff --git a/media/clothing/clothingItems/Prost_Hook_L.xml b/media/clothing/clothingItems/Prost_Hook_L.xml index a41004b..8888e2f 100644 --- a/media/clothing/clothingItems/Prost_Hook_L.xml +++ b/media/clothing/clothingItems/Prost_Hook_L.xml @@ -8,4 +8,4 @@ false metal_base metal_base - + \ No newline at end of file diff --git a/media/clothing/clothingItems/Prost_Hook_R.xml b/media/clothing/clothingItems/Prost_Hook_R.xml new file mode 100644 index 0000000..c6e7eb7 --- /dev/null +++ b/media/clothing/clothingItems/Prost_Hook_R.xml @@ -0,0 +1,11 @@ + + + Prosthesis\hookArm_R_F + Prosthesis\hookArm_R_F + 8ee7e1bc-2c21-428e-a15d-760d98df973d + + false + false + metal_base + metal_base + \ No newline at end of file diff --git a/media/fileGuidTable.xml b/media/fileGuidTable.xml index 6165ede..aa6309d 100644 --- a/media/fileGuidTable.xml +++ b/media/fileGuidTable.xml @@ -31,6 +31,9 @@ media/clothing/clothingItems/Prost_Hook_L.xml 05338f5e-e984-49c2-be79-81af9ae8e818 - + + media/clothing/clothingItems/Prost_Hook_R.xml + 8ee7e1bc-2c21-428e-a15d-760d98df973d + \ No newline at end of file diff --git a/media/lua/client/Handlers/TOC_ProsthesisHandler.lua b/media/lua/client/Handlers/TOC_ProsthesisHandler.lua index 8b13789..5c1db4c 100644 --- a/media/lua/client/Handlers/TOC_ProsthesisHandler.lua +++ b/media/lua/client/Handlers/TOC_ProsthesisHandler.lua @@ -1 +1,62 @@ +local CommonMethods = require("TOC_Common") +local PlayerHandler = require("Handlers/TOC_PlayerHandler") +------------------------- + +---@class ProsthesisHandler +local ProsthesisHandler = {} + + + +function ProsthesisHandler.SetHealthPanelTexture() + -- TODO do it +end + +---comment +---@param bodyLocation string +---@return boolean +function ProsthesisHandler.CheckIfEquippable(bodyLocation) + print("Current item is a prosthesis") + local side = CommonMethods.GetSide(bodyLocation) + + for i=1, #PlayerHandler.amputatedLimbs do + local limbName = PlayerHandler.amputatedLimbs[i] + if string.contains(limbName, side) and not string.contains(limbName, "UpperArm") then + return true + end + end + + -- No acceptable cut limbs + getPlayer():Say("I can't equip this") + return false +end + +--* Overrides *-- + + + + +function ISWearClothing:isValid() + local bodyLocation = self.item:getBodyLocation() + if not string.contains(bodyLocation, "TOC_ArmProst") then + return true + else + return ProsthesisHandler.CheckIfEquippable(bodyLocation) + end +end + + +local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid +function ISClothingExtraAction:isValid() + local bodyLocation = self.item:getBodyLocation() + + if og_ISClothingExtraAction_isValid(self) and not string.contains(bodyLocation, "TOC_ArmProst") then + return true + else + return ProsthesisHandler.CheckIfEquippable(bodyLocation) + + end +end + + +return ProsthesisHandler \ No newline at end of file diff --git a/media/lua/client/TOC_Common.lua b/media/lua/client/TOC_Common.lua index fcb92b3..860e410 100644 --- a/media/lua/client/TOC_Common.lua +++ b/media/lua/client/TOC_Common.lua @@ -1,10 +1,10 @@ local CommonMethods = {} ----Returns the side for a certain limb ----@param limbName string +---Returns the side for a certain limb or prosthesis +---@param name string ---@return string "L" or "R" -function CommonMethods.GetSide(limbName) - if string.find(limbName, "_L") then return "L" else return "R" end +function CommonMethods.GetSide(name) + if string.find(name, "_L") then return "L" else return "R" end end return CommonMethods \ No newline at end of file diff --git a/media/lua/client/TOC_Main.lua b/media/lua/client/TOC_Main.lua index dc49df2..b6c6b92 100644 --- a/media/lua/client/TOC_Main.lua +++ b/media/lua/client/TOC_Main.lua @@ -28,7 +28,7 @@ function Main.SetupTraits() t:addXPBoost(Perks.Strength, -1) end - TraitFactory.addTrait("Insensitive", getText("UI_trait_Insensitive"), 6, getText("UI_trait_Insensitivedesc"), false, false) + TraitFactory.addTrait("Insensitive", getText("UI_trait_Insensitive"), 6, getText("UI_trait_Insensitive_desc"), false, false) TraitFactory.setMutualExclusive("Amputee_Hand", "Amputee_LowerArm") TraitFactory.setMutualExclusive("Amputee_Hand", "Amputee_UpperArm") diff --git a/media/lua/client/UI/TOC_HealthPanel.lua b/media/lua/client/UI/TOC_HealthPanel.lua index 8da97e8..d93c281 100644 --- a/media/lua/client/UI/TOC_HealthPanel.lua +++ b/media/lua/client/UI/TOC_HealthPanel.lua @@ -41,8 +41,8 @@ end function ISHealthPanel.GetHighestAmputation() -- TODO Cache this instead of doing it here! ISHealthPanel.highestAmputations = {} - for i=1, #StaticData.LIMBS_STRINGS do - local limbName = StaticData.LIMBS_STRINGS[i] + for i=1, #PlayerHandler.amputatedLimbs do + local limbName = PlayerHandler.amputatedLimbs[i] local index = CommonMethods.GetSide(limbName) if PlayerHandler.modDataHandler:getIsCut(limbName) and PlayerHandler.modDataHandler:getIsVisible(limbName) then ISHealthPanel.highestAmputations[index] = limbName diff --git a/media/lua/shared/Translate/EN/ContextMenu_EN.txt b/media/lua/shared/Translate/EN/ContextMenu_EN.txt index 37df218..e924b75 100644 --- a/media/lua/shared/Translate/EN/ContextMenu_EN.txt +++ b/media/lua/shared/Translate/EN/ContextMenu_EN.txt @@ -1,4 +1,9 @@ ContextMenu_EN = { ContextMenu_Amputate = "Amputate", + + + ContextMenu_InstallProstRight = "Install prosthesis on right arm", + ContextMenu_InstallProstLeft = "Install prosthesis on left arm", + } diff --git a/media/lua/shared/Translate/EN/UI_EN.txt b/media/lua/shared/Translate/EN/UI_EN.txt index e51a7fd..5a1edad 100644 --- a/media/lua/shared/Translate/EN/UI_EN.txt +++ b/media/lua/shared/Translate/EN/UI_EN.txt @@ -1,2 +1,13 @@ UI_EN = { + UI_trait_Amputee_Hand = "Amputated Left Hand", + UI_trait_Amputee_Hand_desc = "", + + UI_trait_Amputee_LowerArm = "Amputated Left Forearm", + UI_trait_Amputee_LowerArm_desc = "", + + UI_trait_Amputee_UpperArm = "Amputated Left Upper arm", + UI_trait_Amputee_UpperArm_desc = "", + + UI_trait_Insensitive = "Insensitive", + UI_trait_Insensitive_desc = "" } \ No newline at end of file diff --git a/media/models_X/Prosthesis/hookArm_R_F.fbx b/media/models_X/Prosthesis/hookArm_R_F.fbx new file mode 100644 index 0000000..09627e7 Binary files /dev/null and b/media/models_X/Prosthesis/hookArm_R_F.fbx differ diff --git a/media/scripts/TOC_items.txt b/media/scripts/TOC_items.txt index 282b0c6..07cc15f 100644 --- a/media/scripts/TOC_items.txt +++ b/media/scripts/TOC_items.txt @@ -120,13 +120,36 @@ module TOC } /****************** Clothing that look like a cut limb ******************/ - item Prosthesis_Hook_L + item Prost_Hook_L { Type = Clothing, DisplayCategory = Prosthesis, - DisplayName = Hook Arm Test, + DisplayName = Hook Arm Test Left, ClothingItem = Prost_Hook_L, + ClothingItemExtra = Prost_Hook_R, + ClothingItemExtraOption = InstallProstRight, + clothingExtraSubmenu = InstallProstLeft, BodyLocation = TOC_ArmProstLeft, + 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 = Hook Arm Test Right, + ClothingItem = Prost_Hook_R, + ClothingItemExtra = Prost_Hook_L, + ClothingItemExtraOption = InstallProstLeft, + clothingExtraSubmenu = InstallProstRight, + BodyLocation = TOC_ArmProstRight, Weight = 0, CombatSpeedModifier = 0.7,