diff --git a/CheckList.txt b/CheckList.txt new file mode 100644 index 0000000..b33b316 --- /dev/null +++ b/CheckList.txt @@ -0,0 +1,19 @@ + +1) Can cut every limb in SP +2) Does cutting a limb cure infection +3) If I get bit in the hand, will cutting the forearm cure the infection? +4) Both forearm bit, cut everyone, infection cured? +5) Can I operate myself? +6) Can I equip a prost? +7) Can i unequip a prost? + + + +MP TEST +1) Everything up there but in mp env + + + + +-------------------------- +- traits are kinda broken, cant reset them diff --git a/media/lua/client/TOC_Compatibility.lua b/media/lua/client/TOC_Compatibility.lua index 962f987..ad5ab46 100644 --- a/media/lua/client/TOC_Compatibility.lua +++ b/media/lua/client/TOC_Compatibility.lua @@ -38,6 +38,7 @@ function TocCheckCompatibilityWithOlderVersions(mod_data) end end + TocReapplyBodyLocation() @@ -155,3 +156,88 @@ function TocMapOldDataToNew(mod_data) end + + +------------------------------------------------------------------------------------------ + +-- Modified functions for compat reason, used only in one instance +-------------------- +local function TocPartNameToOldBodyLocationProsthesis(name) + if name == "Right_Hand" then return "ArmRight_Prot" end + if name == "Right_LowerArm" then return "ArmRight_Prot" end + if name == "Right_UpperArm" then return "ArmRight_Prot" end + if name == "Left_Hand" then return "ArmLeft_Prot" end + if name == "Left_LowerArm" then return "ArmLeft_Prot" end + if name == "Left_UpperArm" then return "ArmLeft_Prot" end +end + +local function TocPartNameToOldBodyLocationAmputation(name) + if name == "Right_Hand" then return "ArmRight" end + if name == "Right_LowerArm" then return "ArmRight" end + if name == "Right_UpperArm" then return "ArmRight" end + if name == "Left_Hand" then return "ArmLeft" end + if name == "Left_LowerArm" then return "ArmLeft" end + if name == "Left_UpperArm" then return "ArmLeft" end +end + + + +function TocFindAmputationInInventory(player, side, limb) + local player_inventory = player:getInventory() + local item_name = "TOC.Amputation_" .. side .. "_" .. limb + local found_item = player_inventory:FindAndReturn(item_name) + if found_item then + return found_item:getFullType() + + end + +end + +function TocFindEquippedProsthesisInInventory(player, side, limb) + local player_inventory = player:getInventory() + for _, prost in ipairs(GetProsthesisList()) do + local item_name = "TOC.Prost_" .. side .. "_" .. limb .. "_" .. prost + local found_item = player_inventory:FindAndReturn(item_name) + + if found_item then + return found_item:getFullType() + + end + + end + +end + + +function TocOldFindAmputationOrProsthesisName(part_name, player, choice) + + local player_inventory = player:getInventory() + + for _, side in ipairs(TOC_sides) do + for _, limb in ipairs(TOC_limbs) do + local item_name + local found_item + if choice == "Amputation" then + item_name = "TOC.Amputation_" .. side .. "_" .. limb + end + + if choice == "Prosthesis" then + item_name = "TOC.Prost" .. side .. "_" .. limb .. "_MetalHook" -- TODO finish this + + + end + + + found_item = player_inventory:FindAndReturn(item_name) + + if found_item then + return found_item:getFullType() + + end + + + end + end + + +end \ No newline at end of file diff --git a/media/lua/client/TOC_Debug.lua b/media/lua/client/TOC_Debug.lua index c5176d0..23d0697 100644 --- a/media/lua/client/TOC_Debug.lua +++ b/media/lua/client/TOC_Debug.lua @@ -36,6 +36,98 @@ function TocResetEverything() end end + +function TocReapplyBodyLocation() + -- get amputated limbs + local player = getPlayer() + local player_inventory = player:getInventory() + + for _, side in ipairs(TOC_sides) do + for _, limb in ipairs(TOC_limbs) do + local amputation_item_name = TocFindAmputationInInventory(player, side, limb) + local equipped_prosthesis_item_name = TocFindEquippedProsthesisInInventory(player, side, limb) + print(amputation_item_name) + print(equipped_prosthesis_item_name) + if amputation_item_name ~= nil then + + local amputation_item = player_inventory:FindAndReturn(amputation_item_name) + if amputation_item ~= nil then + player:removeWornItem(amputation_item) + player:getInventory():Remove(amputation_item) + amputation_item = player_inventory:AddItem(amputation_item_name) + TocSetCorrectTextureForAmputation(amputation_item, player) + + player:setWornItem(amputation_item:getBodyLocation(), amputation_item) + end + amputation_item = nil -- reset it + end + + if equipped_prosthesis_item_name ~= nil then + local prosthesis_item = player_inventory:FindAndReturn(equipped_prosthesis_item_name) + if prosthesis_item ~= nil then + print("Resetting " .. prosthesis_item:getName()) + player:removeWornItem(prosthesis_item) + player:getInventory():Remove(prosthesis_item) + prosthesis_item = player_inventory:AddItem(equipped_prosthesis_item_name) + player:setWornItem(prosthesis_item:getBodyLocation(), prosthesis_item) + + end + prosthesis_item = nil -- reset it + end + + + + end + end + + + + -- for _, v in ipairs(GetBodyParts()) do + + -- local amputation_item_name = TocOldFindAmputationOrProsthesisName(v, player, "Amputation") + -- local prosthesis_item_name = TocOldFindAmputationOrProsthesisName(v, player, "Prosthesis") + + -- print(amputation_item_name) + -- print(prosthesis_item_name) + -- if amputation_item_name ~= nil then + + -- local amputation_item = player_inventory:FindAndReturn(amputation_item_name) + -- if amputation_item ~= nil then + -- player:removeWornItem(amputation_item) + -- player:getInventory():Remove(amputation_item) + -- amputation_item = player_inventory:AddItem(amputation_item_name) + -- player:setWornItem(amputation_item:getBodyLocation(), amputation_item) + -- end + -- amputation_item = nil -- reset it + -- end + -- if prosthesis_item_name ~= nil then + -- local prosthesis_item = player_inventory:FindAndReturn(prosthesis_item_name) + -- if prosthesis_item ~= nil then + -- print("Resetting " .. prosthesis_item:getName()) + -- player:removeWornItem(prosthesis_item) + -- player:getInventory():Remove(prosthesis_item) + -- prosthesis_item = player_inventory:AddItem(prosthesis_item_name) + -- player:setWornItem(prosthesis_item:getBodyLocation(), prosthesis_item) + + -- end + -- prosthesis_item = nil -- reset it + -- end + + + -- end + + -- -- get prosthe + + + -- -- fix them + + + -- -- reapply them + + + +end + ----------------------------------------------------------------------- diff --git a/media/lua/client/TOC_HelperFunctions.lua b/media/lua/client/TOC_HelperFunctions.lua index f7719b3..cf6dae8 100644 --- a/media/lua/client/TOC_HelperFunctions.lua +++ b/media/lua/client/TOC_HelperFunctions.lua @@ -146,23 +146,21 @@ end -- Unequip Prosthesis local function PartNameToBodyLocationProsthesis(name) - -- This is still correct but naming sucks - if name == "Right_Hand" then return "ArmRight_Prot" end - if name == "Right_LowerArm" then return "ArmRight_Prot" end - if name == "Right_UpperArm" then return "ArmRight_Prot" end - if name == "Left_Hand" then return "ArmLeft_Prot" end - if name == "Left_LowerArm" then return "ArmLeft_Prot" end - if name == "Left_UpperArm" then return "ArmLeft_Prot" end + if name == "Right_Hand" then return "TOC_ArmRightProsthesis" end + if name == "Right_LowerArm" then return "TOC_ArmRightProsthesis" end + if name == "Right_UpperArm" then return "TOC_ArmRightProsthesis" end + if name == "Left_Hand" then return "TOC_ArmLeftProsthesis" end + if name == "Left_LowerArm" then return "TOC_ArmLeftProsthesis" end + if name == "Left_UpperArm" then return "TOC_ArmLeftProsthesis" end end local function PartNameToBodyLocationAmputation(name) - -- This is still correct but naming sucks - if name == "Right_Hand" then return "ArmRight" end - if name == "Right_LowerArm" then return "ArmRight" end - if name == "Right_UpperArm" then return "ArmRight" end - if name == "Left_Hand" then return "ArmLeft" end - if name == "Left_LowerArm" then return "ArmLeft" end - if name == "Left_UpperArm" then return "ArmLeft" end + if name == "Right_Hand" then return "TOC_ArmRight" end + if name == "Right_LowerArm" then return "TOC_ArmRight" end + if name == "Right_UpperArm" then return "TOC_ArmRight" end + if name == "Left_Hand" then return "TOC_ArmLeft" end + if name == "Left_LowerArm" then return "TOC_ArmLeft" end + if name == "Left_UpperArm" then return "TOC_ArmLeft" end end function TocFindItemInProstBodyLocation(part_name, patient) @@ -189,10 +187,7 @@ function TocFindAmputationOrProsthesisName(part_name, player, choice) if item:getBodyLocation() == PartNameToBodyLocationAmputation(part_name) then return item:getFullType() - end - - elseif choice == "Prosthesis" then if item:getBodyLocation() == PartNameToBodyLocationProsthesis(part_name) then @@ -203,9 +198,6 @@ function TocFindAmputationOrProsthesisName(part_name, player, choice) end - - - end ------------------------------------- diff --git a/media/lua/shared/NPCs/ExtraBodyLocations.lua b/media/lua/shared/NPCs/ExtraBodyLocations.lua index d75ea39..828e213 100644 --- a/media/lua/shared/NPCs/ExtraBodyLocations.lua +++ b/media/lua/shared/NPCs/ExtraBodyLocations.lua @@ -68,14 +68,14 @@ local group = BodyLocations.getGroup("Human") -addBodyLocationBefore("ArmRight", "Shoes") -addBodyLocationBefore("ArmLeft", "Shoes") -addBodyLocationBefore("ArmRight_Prot", "Shoes") -addBodyLocationBefore("ArmLeft_Prot", "Shoes") +addBodyLocationBefore("TOC_ArmRight", "Shoes") +addBodyLocationBefore("TOC_ArmLeft", "Shoes") +addBodyLocationBefore("TOC_ArmRightProsthesis", "Shoes") +addBodyLocationBefore("TOC_ArmLeftProsthesis", "Shoes") --- group:getOrCreateLocation("ArmRight") +-- group:getOrCreateLocation("TOC_ArmRight") -- group:getOrCreateLocation("ArmLeft") -- group:getOrCreateLocation("ArmRight_Prot") -- group:getOrCreateLocation("ArmLeft_Prot") \ No newline at end of file diff --git a/media/models_X/Prost_Right_LowerArm_Hook_Male.fbx b/media/models_X/Prost_Right_LowerArm_Hook_Male.fbx index 3fceff5..932f055 100644 Binary files a/media/models_X/Prost_Right_LowerArm_Hook_Male.fbx and b/media/models_X/Prost_Right_LowerArm_Hook_Male.fbx differ diff --git a/media/scripts/TOC_items.txt b/media/scripts/TOC_items.txt index 1fdd602..48072ab 100644 --- a/media/scripts/TOC_items.txt +++ b/media/scripts/TOC_items.txt @@ -11,7 +11,7 @@ imports DisplayName = Amputated right hand, ClothingItem = Amputation_Right_Hand, - BodyLocation = ArmRight, + BodyLocation = TOC_ArmRight, Weight = 0, CombatSpeedModifier = 0.9, @@ -30,7 +30,7 @@ imports DisplayName = Amputated right forearm, ClothingItem = Amputation_Right_LowerArm, - BodyLocation = ArmRight, + BodyLocation = TOC_ArmRight, Weight = 0, CombatSpeedModifier = 0.8, @@ -48,7 +48,7 @@ imports DisplayName = Amputated entire right arm, ClothingItem = Amputation_Right_UpperArm, - BodyLocation = ArmRight, + BodyLocation = TOC_ArmRight, BloodLocation = UpperArms;UpperBody, Weight = 0, CombatSpeedModifier = 0.7, @@ -65,7 +65,7 @@ imports DisplayName = Amputated left hand, ClothingItem = Amputation_Left_Hand, - BodyLocation = ArmLeft, + BodyLocation = TOC_ArmLeft, Weight = 0, CombatSpeedModifier = 0.9, @@ -84,7 +84,7 @@ imports DisplayCategory = Amputation, DisplayName = Amputated left forearm, ClothingItem = Amputation_Left_LowerArm, - BodyLocation = ArmLeft, + BodyLocation = TOC_ArmLeft, Weight = 0, CombatSpeedModifier = 0.8, @@ -102,7 +102,7 @@ imports Type = Clothing, DisplayName = Amputated entire left arm, ClothingItem = Amputation_Left_UpperArm, - BodyLocation = ArmLeft, + BodyLocation = TOC_ArmLeft, Weight = 0, CombatSpeedModifier = 0.7, @@ -157,7 +157,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Right Hand - Wooden Hook, ClothingItem = Prost_Right_Hand_WoodenHook, - BodyLocation = ArmRight_Prot, + BodyLocation = TOC_ArmRightProsthesis, BloodLocation = Hands, Icon = woodenHook, Tooltip = Tooltip_equip_prothesis_hand, @@ -173,7 +173,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Left Hand - Wooden Hook, ClothingItem = Prost_Left_Hand_WoodenHook, - BodyLocation = ArmLeft_Prot, + BodyLocation = TOC_ArmLeftProsthesis, BloodLocation = Hands, Icon = woodenHook, Tooltip = Tooltip_equip_prothesis_hand, @@ -189,7 +189,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Right Hand - Metal Hook, ClothingItem = Prost_Right_Hand_MetalHook, - BodyLocation = ArmRight_Prot, + BodyLocation = TOC_ArmRightProsthesis, BloodLocation = Hands, Icon = metalHook, Tooltip = Tooltip_equip_prothesis_hand, @@ -204,7 +204,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Left Hand - Metal Hook, ClothingItem = Prost_Left_Hand_MetalHook, - BodyLocation = ArmLeft_Prot, + BodyLocation = TOC_ArmLeftProsthesis, BloodLocation = Hands, Icon = metalHook, Tooltip = Tooltip_equip_prothesis_hand, @@ -219,7 +219,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Right Hand - Metal Hand, ClothingItem = Prost_Right_Hand_MetalHand, - BodyLocation = ArmRight_Prot, + BodyLocation = TOC_ArmRightProsthesis, BloodLocation = Hands, Icon = metalHand, Tooltip = Tooltip_equip_prothesis_hand, @@ -234,7 +234,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Left Hand - Metal Hand, ClothingItem = Prost_Left_Hand_MetalHand, - BodyLocation = ArmLeft_Prot, + BodyLocation = TOC_ArmLeftProsthesis, BloodLocation = Hands, Icon = metalHand, Tooltip = Tooltip_equip_prothesis_hand", @@ -249,7 +249,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Right Forearm - Wooden Hook, ClothingItem = Prost_Right_LowerArm_WoodenHook, - BodyLocation = ArmRight_Prot, + BodyLocation = TOC_ArmRightProsthesis, BloodLocation = LowerArms;Hands, Icon = woodenHook, Tooltip = Tooltip_equip_prothesis_fore, @@ -264,7 +264,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Left Forearm - Wooden Hook, ClothingItem = Prost_Left_LowerArm_WoodenHook, - BodyLocation = ArmLeft_Prot, + BodyLocation = TOC_ArmLeftProsthesis, BloodLocation = LowerArms;Hands, Icon = woodenHook, @@ -280,7 +280,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Right Forearm - Metal Hook, ClothingItem = Prost_Right_LowerArm_MetalHook, - BodyLocation = ArmRight_Prot, + BodyLocation = TOC_ArmRightProsthesis, BloodLocation = LowerArms;Hands, Icon = metalHook, Tooltip = Tooltip_equip_prothesis_fore, @@ -295,7 +295,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Left Forearm - Metal Hook, ClothingItem = Prost_Left_LowerArm_MetalHook, - BodyLocation = ArmLeft_Prot, + BodyLocation = TOC_ArmLeftProsthesis, BloodLocation = LowerArms;Hands, Icon = metalHook, @@ -311,7 +311,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Right Forearm - Metal Hand, ClothingItem = Prost_Right_LowerArm_MetalHand, - BodyLocation = ArmRight_Prot, + BodyLocation = TOC_ArmRightProsthesis, BloodLocation = LowerArms;Hands, Icon = metalHand, Tooltip = Tooltip_equip_prothesis_fore, @@ -326,7 +326,7 @@ imports DisplayCategory = Prosthesis, DisplayName = Left Forearm - Metal Hand, ClothingItem = Prost_Left_LowerArm_MetalHand, - BodyLocation = ArmLeft_Prot, + BodyLocation = TOC_ArmLeftProsthesis, BloodLocation = LowerArms;Hands, Icon = metalHand, Tooltip = Tooltip_equip_prothesis_fore,