diff --git a/media/clothing/clothingItems/Prost_Hook_L.xml b/media/clothing/clothingItems/Prost_Hook_L.xml index 8888e2f..ad9e0f7 100644 --- a/media/clothing/clothingItems/Prost_Hook_L.xml +++ b/media/clothing/clothingItems/Prost_Hook_L.xml @@ -6,6 +6,5 @@ false false - metal_base - metal_base + Prosthesis\hookArmTest \ No newline at end of file diff --git a/media/clothing/clothingItems/Prost_Hook_R.xml b/media/clothing/clothingItems/Prost_Hook_R.xml index c6e7eb7..9e237f3 100644 --- a/media/clothing/clothingItems/Prost_Hook_R.xml +++ b/media/clothing/clothingItems/Prost_Hook_R.xml @@ -6,6 +6,5 @@ false false - metal_base - metal_base + Prosthesis\hookArmTest \ No newline at end of file diff --git a/media/lua/client/TOC/Handlers/ItemsHandler.lua b/media/lua/client/TOC/Handlers/ItemsHandler.lua index 50d0a92..0139deb 100644 --- a/media/lua/client/TOC/Handlers/ItemsHandler.lua +++ b/media/lua/client/TOC/Handlers/ItemsHandler.lua @@ -25,6 +25,7 @@ function ItemsHandler.GetAmputationTexturesIndex(playerObj, isCicatrized) matchedIndex = matchedIndex + 5 end + if isCicatrized then if isHairy then matchedIndex = matchedIndex + 5 -- to use the cicatrized texture on hairy bodies diff --git a/media/lua/client/TOC/Handlers/ModDataHandler.lua b/media/lua/client/TOC/Handlers/ModDataHandler.lua index 7657bf4..372b2ac 100644 --- a/media/lua/client/TOC/Handlers/ModDataHandler.lua +++ b/media/lua/client/TOC/Handlers/ModDataHandler.lua @@ -51,7 +51,10 @@ function ModDataHandler:setup(key) } ---@type partData - local defaultParams = {isCut = false, isInfected = false, isOperated = false, isCicatrized = false, isCauterized = false, isVisible = false} + local defaultParams = { + isCut = false, isInfected = false, isOperated = false, isCicatrized = false, + isCauterized = false, isVisible = false, isProstEquipped = false, prostFactor = 0 + } -- Initialize limbs for i=1, #StaticData.LIMBS_STRINGS do @@ -76,6 +79,12 @@ function ModDataHandler:setIsAnyLimbCut(isAnyLimbCut) self.tocData.isAnyLimbCut = isAnyLimbCut end +---Set isIgnoredPartInfected +---@param isIgnoredPartInfected boolean +function ModDataHandler:setIsIgnoredPartInfected(isIgnoredPartInfected) + self.tocData.isIgnoredPartInfected = isIgnoredPartInfected +end + ---Set isCut ---@param limbName string ---@param isCut boolean @@ -90,10 +99,18 @@ function ModDataHandler:setIsInfected(limbName, isInfected) self.tocData[limbName].isInfected = isInfected end ----Set isIgnoredPartInfected ----@param isIgnoredPartInfected boolean -function ModDataHandler:setIsIgnoredPartInfected(isIgnoredPartInfected) - self.tocData.isIgnoredPartInfected = isIgnoredPartInfected +---Set isProstEquipped +---@param limbName string +---@param isProstEquipped boolean +function ModDataHandler:setIsProstEquipped(limbName, isProstEquipped) + self.tocData[limbName].isProstEquipped = isProstEquipped +end + +---Set prostFactor +---@param limbName string +---@param prostFactor number +function ModDataHandler:setProstFactor(limbName, prostFactor) + self.tocData[limbName].prostFactor = prostFactor end ----------------- @@ -105,6 +122,12 @@ function ModDataHandler:getIsAnyLimbCut() return self.tocData.isAnyLimbCut end +---Get isIgnoredPartInfected +---@return boolean +function ModDataHandler:getIsIgnoredPartInfected() + return self.tocData.isIgnoredPartInfected +end + ---Get isCut ---@param limbName string ---@return boolean @@ -112,18 +135,27 @@ function ModDataHandler:getIsCut(limbName) return self.tocData[limbName].isCut end ----Get isIgnoredPartInfected ----@return boolean -function ModDataHandler:getIsIgnoredPartInfected() - return self.tocData.isIgnoredPartInfected -end - ---Get isVisible +---@param limbName string ---@return boolean function ModDataHandler:getIsVisible(limbName) return self.tocData[limbName].isVisible end +---Get isProstEquipped +---@param limbName string +---@return boolean +function ModDataHandler:getIsProstEquipped(limbName) + return self.tocData[limbName].isProstEquipped +end + +---Get prostFactor +---@param limbName string +---@return number +function ModDataHandler:getProstFactor(limbName) + return self.tocData[limbName].getProstFactor +end + --* Limbs data handling *-- ---Set a limb and its dependend limbs as cut @@ -167,6 +199,8 @@ function ModDataHandler:setLimbParams(limbName, ampStatus, cicatrizationTime) if ampStatus.isCicatrized ~= nil then limbData.isCicatrized = ampStatus.isCicatrized end if ampStatus.isCauterized ~= nil then limbData.isCauterized = ampStatus.isCauterized end if ampStatus.isVisible ~= nil then limbData.isVisible = ampStatus.isVisible end + if ampStatus.isProstEquipped ~= nil then limbData.isProstEquipped = ampStatus.isProstEquipped end + if ampStatus.prostFactor ~= nil then limbData.prostFactor = ampStatus.prostFactor end if cicatrizationTime ~= nil then limbData.cicatrizationTime = cicatrizationTime end end diff --git a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua index 1675499..f946222 100644 --- a/media/lua/client/TOC/Handlers/ProsthesisHandler.lua +++ b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua @@ -46,13 +46,14 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid ---@diagnostic disable-next-line: duplicate-set-field function ISClothingExtraAction:isValid() local bodyLocation = self.item:getBodyLocation() - + local isEquippable = false if og_ISClothingExtraAction_isValid(self) and not string.contains(bodyLocation, "TOC_ArmProst") then - return true + isEquippable = true else - return ProsthesisHandler.CheckIfEquippable(bodyLocation) - + isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation) end + + return isEquippable end diff --git a/media/lua/client/TOC/Handlers/SurgeryHandler.lua b/media/lua/client/TOC/Handlers/SurgeryHandler.lua new file mode 100644 index 0000000..8877652 --- /dev/null +++ b/media/lua/client/TOC/Handlers/SurgeryHandler.lua @@ -0,0 +1,10 @@ +local ModDataHandler = require("TOC/Handlers/ModDataHandler") + +local SurgeryHandler = {} + +function SurgeryHandler.InstallProsthesis() + -- TODO Set stuff in mod data + +end + +return SurgeryHandler \ No newline at end of file diff --git a/media/lua/client/TOC/TimedActions/OperateAction.lua b/media/lua/client/TOC/TimedActions/OperateAction.lua new file mode 100644 index 0000000..893272c --- /dev/null +++ b/media/lua/client/TOC/TimedActions/OperateAction.lua @@ -0,0 +1 @@ +-- temp \ No newline at end of file diff --git a/media/lua/client/TOC/UI/CutLimbInteractions.lua b/media/lua/client/TOC/UI/CutLimbInteractions.lua index f61ed83..187e5c6 100644 --- a/media/lua/client/TOC/UI/CutLimbInteractions.lua +++ b/media/lua/client/TOC/UI/CutLimbInteractions.lua @@ -66,7 +66,7 @@ local CutLimbHandler = BaseHandler:derive("CutLimbHandler") function CutLimbHandler:new(panel, bodyPart) local o = BaseHandler.new(self, panel, bodyPart) o.items.ITEMS = {} - o.limbName = BodyPartType.ToString(self.bodyPart:getType()) + o.limbName = BodyPartType.ToString(bodyPart:getType()) TOC_DEBUG.print("init CutLimbHandler") return o end diff --git a/media/lua/client/TOC/UI/SurgeryInteractions.lua b/media/lua/client/TOC/UI/SurgeryInteractions.lua index 89a45e8..e7961b5 100644 --- a/media/lua/client/TOC/UI/SurgeryInteractions.lua +++ b/media/lua/client/TOC/UI/SurgeryInteractions.lua @@ -24,6 +24,8 @@ end ---@param worldObjects any ---@param test any local function AddOvenContextMenu(playerNum, context, worldObjects, test) + if test then return true end + local pl = getSpecificPlayer(playerNum) if not ModDataHandler.GetInstance():getIsAnyLimbCut() then return end diff --git a/media/lua/shared/TOC/BodyLocations.lua b/media/lua/shared/TOC/BodyLocations.lua index a2586ee..dce76b1 100644 --- a/media/lua/shared/TOC/BodyLocations.lua +++ b/media/lua/shared/TOC/BodyLocations.lua @@ -13,9 +13,9 @@ local function AddBodyLocationBefore(newLocation, moveToLocation) end -AddBodyLocationBefore("TOC_ArmRight", "Shoes") -AddBodyLocationBefore("TOC_ArmLeft", "Shoes") +AddBodyLocationBefore("TOC_Arm_R", "Shoes") +AddBodyLocationBefore("TOC_Arm_L", "Shoes") -AddBodyLocationBefore("TOC_ArmProstRight", "Shoes") -AddBodyLocationBefore("TOC_ArmProstLeft", "Shoes") +AddBodyLocationBefore("TOC_ArmProst_R", "Shoes") +AddBodyLocationBefore("TOC_ArmProst_L", "Shoes") diff --git a/media/lua/shared/TOC/StaticData.lua b/media/lua/shared/TOC/StaticData.lua index 015eb0b..0ee7b4e 100644 --- a/media/lua/shared/TOC/StaticData.lua +++ b/media/lua/shared/TOC/StaticData.lua @@ -1,4 +1,4 @@ ----@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number } +---@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number, isProstEquipped : boolean, prostFactor : number} ---@alias tocModData {Hand_L : partData, ForeArm_L : partData, UpperArm_L : partData, Hand_R : partData, ForeArm_R : partData, UpperArm_R : partData, isIgnoredPartInfected : boolean, isAnyLimbCut : boolean} --------------------------- diff --git a/media/scripts/TOC_items.txt b/media/scripts/TOC_items.txt index 07cc15f..aae3ca3 100644 --- a/media/scripts/TOC_items.txt +++ b/media/scripts/TOC_items.txt @@ -12,7 +12,7 @@ module TOC DisplayName = Amputated right hand, ClothingItem = Amputation_Hand_R, - BodyLocation = TOC_ArmRight, + BodyLocation = TOC_Arm_R, Weight = 0, CombatSpeedModifier = 0.9, @@ -32,7 +32,7 @@ module TOC DisplayName = Amputated right forearm, ClothingItem = Amputation_ForeArm_R, - BodyLocation = TOC_ArmRight, + BodyLocation = TOC_Arm_R, Weight = 0, CombatSpeedModifier = 0.8, @@ -51,7 +51,7 @@ module TOC DisplayName = Amputated entire right arm, ClothingItem = Amputation_UpperArm_R, - BodyLocation = TOC_ArmRight, + BodyLocation = TOC_Arm_R, BloodLocation = UpperArms;UpperBody, Weight = 0, CombatSpeedModifier = 0.7, @@ -69,7 +69,7 @@ module TOC DisplayName = Amputated left hand, ClothingItem = Amputation_Hand_L, - BodyLocation = TOC_ArmLeft, + BodyLocation = TOC_Arm_L, Weight = 0, CombatSpeedModifier = 0.9, @@ -88,7 +88,7 @@ module TOC DisplayCategory = Amputation, DisplayName = Amputated left forearm, ClothingItem = Amputation_ForeArm_L, - BodyLocation = TOC_ArmLeft, + BodyLocation = TOC_Arm_L, Weight = 0, CombatSpeedModifier = 0.8, @@ -107,7 +107,7 @@ module TOC DisplayCategory = Amputation, DisplayName = Amputated entire left arm, ClothingItem = Amputation_UpperArm_L, - BodyLocation = TOC_ArmLeft, + BodyLocation = TOC_Arm_L, Weight = 0, CombatSpeedModifier = 0.7, @@ -129,7 +129,7 @@ module TOC ClothingItemExtra = Prost_Hook_R, ClothingItemExtraOption = InstallProstRight, clothingExtraSubmenu = InstallProstLeft, - BodyLocation = TOC_ArmProstLeft, + BodyLocation = TOC_ArmProst_L, Weight = 0, CombatSpeedModifier = 0.7, BloodLocation = UpperArms;UpperBody, @@ -149,7 +149,7 @@ module TOC ClothingItemExtra = Prost_Hook_L, ClothingItemExtraOption = InstallProstLeft, clothingExtraSubmenu = InstallProstRight, - BodyLocation = TOC_ArmProstRight, + BodyLocation = TOC_ArmProst_R, Weight = 0, CombatSpeedModifier = 0.7, diff --git a/media/textures/Prosthesis/hookArmTest.png b/media/textures/Prosthesis/hookArmTest.png new file mode 100644 index 0000000..4b8083b Binary files /dev/null and b/media/textures/Prosthesis/hookArmTest.png differ diff --git a/media/textures/Prosthesis/knifeArm.png b/media/textures/Prosthesis/knifeArm.png new file mode 100644 index 0000000..4c2467f Binary files /dev/null and b/media/textures/Prosthesis/knifeArm.png differ