diff --git a/.vscode/settings.json b/.vscode/settings.json index ee71638..1930a37 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -37,6 +37,9 @@ "forceDropHeavyItems", "getPlayerHotbar", "isServer", - "BodyLocations" + "BodyLocations", + "ISUnequipAction", + "ISInventoryPaneContextMenu", + "ISDropItemAction" ] } \ No newline at end of file diff --git a/media/lua/client/TOC_HelperFunctions.lua b/media/lua/client/TOC_HelperFunctions.lua index 9a86b63..9fb0b9e 100644 --- a/media/lua/client/TOC_HelperFunctions.lua +++ b/media/lua/client/TOC_HelperFunctions.lua @@ -69,3 +69,34 @@ function FixSingleBodyPartType(body_part_type, use_oven) --body_part_type:setBleedingTime(ZombRand(1, 5)) -- Reset the bleeding, maybe make it random end end + + +------------------------------------- +-- Override helper + +function CheckIfItemIsAmputatedLimb(item) + + local item_full_type = item:getFullType() + + local sides = {"Left", "Right"} + local limbs_to_check = {"Hand", "Forearm", "Arm"} + + local is_amputated_limb = false + + for _, part_name in ipairs(limbs_to_check) do + for _, side in ipairs(sides) do + local check_name = "TOC.Arm" .. side .. "_no" .. part_name + print(check_name) + if item_full_type == check_name then + is_amputated_limb = true + break + end + + end + + end + + + return is_amputated_limb + +end \ No newline at end of file diff --git a/media/lua/client/TimedActions/OverridedFunctions.lua b/media/lua/client/TimedActions/OverridenFunctions.lua similarity index 55% rename from media/lua/client/TimedActions/OverridedFunctions.lua rename to media/lua/client/TimedActions/OverridenFunctions.lua index 88838c4..71bc291 100644 --- a/media/lua/client/TimedActions/OverridedFunctions.lua +++ b/media/lua/client/TimedActions/OverridenFunctions.lua @@ -1,9 +1,11 @@ require "TimedActions/ISBaseTimedAction" require "TimedActions/ISEquipWeaponAction" +require "TimedActions/ISUnequipAction" +require "TimedActions/ISDropItemAction" +local og_ISEquipTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime -local og_ISEquipTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime - +-- FIXME something is seriously broken here, it stacks up function ISBaseTimedAction:adjustMaxTime(maxTime) local original_max_time = og_ISEquipTimedActionAdjustMaxTime(self, maxTime) -- TODO will it work? @@ -42,6 +44,11 @@ function ISBaseTimedAction:adjustMaxTime(maxTime) end if modified_max_time > 10 * original_max_time then modified_max_time = 10 * original_max_time end + + + print("MODIFIED MAX TIME: " .. modified_max_time) + + return modified_max_time end @@ -91,4 +98,92 @@ function ISEquipWeaponAction:perform() -end \ No newline at end of file +end + + + + +-- local og_ISInventoryPaneContextMenuDoWearClothingMenu = ISInventoryPaneContextMenu.doWearClothingMenu + +-- function ISInventoryPaneContextMenu.doWearClothingMenu(player, clothing, items, context) + +-- og_ISInventoryPaneContextMenuDoWearClothingMenu(self, player, clothing, items, context) + + +-- end + + +local og_ISUnequipActionPerform = ISUnequipAction.perform + +function ISUnequipAction:perform() +-- -- check if the "clothing" is actually an amputation + + +-- -- for _, v in ipairs(GetBodyParts()) do +-- -- local amputation = TocFindAmputatedClothingFromPartName(v) +-- -- if amputation then + +-- -- end +-- -- end + + + + if not CheckIfItemIsAmputatedLimb(self.item) then + og_ISUnequipActionPerform(self) + end + + +end + + +local og_ISDropItemActionPerform = ISDropItemAction.perform + +function ISDropItemAction:perform() + + if not CheckIfItemIsAmputatedLimb(self.item) then + og_ISDropItemActionPerform(self) + end + + +end +-- TODO Add "Clean Wound" to make the cicatrization faster + + + +-- local og_ISInventoryPaneContextMenuCreateMenu = ISInventoryPaneContextMenu.createMenu + +-- function ISInventoryPaneContextMenu.createMenu(player, isInPlayerInventory, items, x, y, origin) + +-- og_ISInventoryPaneContextMenuCreateMenu(player, isInPlayerInventory, items, x, y, origin) + +-- local items_to_delete = GetAmputatedLimbFullTypes() +-- local item_try_again +-- local test_item = nil +-- local item_to_test = nil +-- --local seccontext = ISContextMenu.get(player, x, y); + + + + +-- for index, v in ipairs(items) do +-- test_item = v + +-- if not instanceof(v, "InventoryItem") then +-- item_to_test = v.items[1] +-- for _, item_to_delete in ipairs(items_to_delete) do +-- local item_type = item_to_test:getFullType() +-- print("ITEM IN INV " ..item_type) +-- print("CHECKING STRING " .. item_to_delete) +-- if item_type == item_to_delete then +-- --seccontext:removeOptionByName(getText("ContextMenu_Unequip")) -- IT IS ALREADY DEFINED!!! +-- end +-- end +-- end +-- end + + + + + + +-- end diff --git a/media/lua/client/Utils/UsefulFunctions.lua b/media/lua/client/Utils/UsefulFunctions.lua index 94fe051..74199a6 100644 --- a/media/lua/client/Utils/UsefulFunctions.lua +++ b/media/lua/client/Utils/UsefulFunctions.lua @@ -40,6 +40,14 @@ end function GetNonAcceptingProsthesisBodyParts() return {"RightArm", "LeftArm"} end + +function GetAmputatedLimbFullTypes() + + return {"TOC.ArmRight_noHand", "TOC.ArmRight_noForearm", "TOC.ArmRight_noArm", + "TOC.ArmLeft_noHand", "TOC.ArmLeft_noForearm", "TOC.ArmLeft_noArm"} +end + + local function PartNameToBodyLocation(name) if name == "RightHand" then return "ArmRight_Prot" end if name == "RightForearm" then return "ArmRight_Prot" end @@ -127,6 +135,21 @@ function TocFindAmputatedClothingFromPartName(part_name) end +-- TODO finish this +-- function TocFindIfClothingItemIsAmputatedLimb(item_name) + + + +-- if item_name == "ArmRight_noHand" +-- local check = + +-- end + + + + + + function TocFindProsthesisFactorFromItem(item) local itemType = item:getType() diff --git a/media/lua/shared/translate/EN/ItemName_EN.txt b/media/lua/shared/translate/EN/ItemName_EN.txt index 07af0f3..9fa3c65 100644 --- a/media/lua/shared/translate/EN/ItemName_EN.txt +++ b/media/lua/shared/translate/EN/ItemName_EN.txt @@ -28,4 +28,16 @@ DisplayName_EN = { ItemName_TOC.ProthesisMag1 = "Prothesis magazine for dummies", ItemName_TOC.ProthesisMag2 = "Prothesis magazine for experienced", ItemName_TOC.ProthesisMag3 = "Prothesis magazine for experts", + + + ItemName_TOC.ArmLeft_noHand = "Amputated left hand", + ItemName_TOC.ArmLeft_noForearm = "Amputated left forearm", + ItemName_TOC.ArmLeft_noArm = "Amputated entire left arm", + + ItemName_TOC.ArmRight_noHand = "Amputated left hand", + ItemName_TOC.ArmRight_noForearm = "Amputated left forearm", + ItemName_TOC.ArmRight_noArm = "Amputated entire left arm", + + + } \ No newline at end of file diff --git a/media/lua/shared/translate/EN/Tooltip_EN.txt b/media/lua/shared/translate/EN/Tooltip_EN.txt index 7ccea0b..fd8cec4 100644 --- a/media/lua/shared/translate/EN/Tooltip_EN.txt +++ b/media/lua/shared/translate/EN/Tooltip_EN.txt @@ -23,4 +23,7 @@ Tooltip_EN = { Tooltip_ProthesisMag1 = "Learn how to make a wooden hook!" Tooltip_ProthesisMag2 = "Learn how to make a metal hook!" Tooltip_ProthesisMag3 = "Learn how to make a metal hand!" + + + } \ No newline at end of file diff --git a/media/models_X/ArmLeft_Hook_fore.fbx b/media/models_X/ArmLeft_Hook_fore.fbx index 934d414..839b035 100644 Binary files a/media/models_X/ArmLeft_Hook_fore.fbx and b/media/models_X/ArmLeft_Hook_fore.fbx differ diff --git a/media/scripts/TOC_items.txt b/media/scripts/TOC_items.txt index 50eb8c5..8676aea 100644 --- a/media/scripts/TOC_items.txt +++ b/media/scripts/TOC_items.txt @@ -8,79 +8,104 @@ imports item ArmRight_noHand { Type = Clothing, + DisplayName = Amputated right hand, + ClothingItem = ArmRight_noHand, BodyLocation = ArmRight, Weight = 0, CombatSpeedModifier = 0.9, + /*BloodLocation = UpperArms;LowerArms,*/ + Insulation = 1.0, WindResistance = 1.0, WaterResistance = 1.0, + Icon = genericAmputation, } item ArmRight_noForearm { Type = Clothing, + DisplayName = Amputated right forearm, + ClothingItem = ArmRight_noForeArm, BodyLocation = ArmRight, Weight = 0, CombatSpeedModifier = 0.8, + BloodLocation = UpperArms;LowerArms, Insulation = 1.0, WindResistance = 1.0, WaterResistance = 1.0, + Icon = genericAmputation, } item ArmRight_noArm { Type = Clothing, + DisplayName = Amputated entire right arm, + ClothingItem = ArmRight_noArm, BodyLocation = ArmRight, - + /*BloodLocation = UpperArms,*/ Weight = 0, CombatSpeedModifier = 0.7, Insulation = 1.0, WindResistance = 1.0, WaterResistance = 1.0, + Icon = genericAmputation, } item ArmLeft_noHand { Type = Clothing, + DisplayName = Amputated left hand, + ClothingItem = ArmLeft_noHand, BodyLocation = ArmLeft, Weight = 0, CombatSpeedModifier = 0.9, + /*BloodLocation = UpperArms;LowerArms,*/ Insulation = 1.0, + WindResistance = 1.0, WaterResistance = 1.0, + Icon = genericAmputation, } item ArmLeft_noForearm { Type = Clothing, + DisplayCategory = Amputation, + DisplayName = Amputated left forearm, ClothingItem = ArmLeft_noForeArm, BodyLocation = ArmLeft, Weight = 0, CombatSpeedModifier = 0.8, + BloodLocation = UpperArms;LowerArms, Insulation = 1.0, WindResistance = 1.0, WaterResistance = 1.0, + Icon = genericAmputation, + } item ArmLeft_noArm { Type = Clothing, + DisplayName = Amputated entire left arm, ClothingItem = ArmLeft_noArm, BodyLocation = ArmLeft, Weight = 0, CombatSpeedModifier = 0.7, + /*BloodLocation = UpperArms,*/ Insulation = 1.0, WindResistance = 1.0, WaterResistance = 1.0, + Icon = genericAmputation, } /************************ Other items ************************/ diff --git a/media/textures/Clothes/Untitled-1.png b/media/textures/Clothes/Untitled-1.png new file mode 100644 index 0000000..089fc69 Binary files /dev/null and b/media/textures/Clothes/Untitled-1.png differ diff --git a/media/textures/Clothes/prototype.png b/media/textures/Clothes/prototype.png index 2d63295..b79b38d 100644 Binary files a/media/textures/Clothes/prototype.png and b/media/textures/Clothes/prototype.png differ diff --git a/media/textures/Clothes/prototype2.png b/media/textures/Clothes/prototype2.png new file mode 100644 index 0000000..2d63295 Binary files /dev/null and b/media/textures/Clothes/prototype2.png differ diff --git a/media/textures/Item_genericAmputation.png b/media/textures/Item_genericAmputation.png new file mode 100644 index 0000000..c8dd306 Binary files /dev/null and b/media/textures/Item_genericAmputation.png differ