diff --git a/media/clothing/clothingItems/Amputation_Left_Hand.xml b/media/clothing/clothingItems/Amputation_Left_Hand.xml index f07f22d..3ac7028 100644 --- a/media/clothing/clothingItems/Amputation_Left_Hand.xml +++ b/media/clothing/clothingItems/Amputation_Left_Hand.xml @@ -13,4 +13,10 @@ Amputations\skin03b Amputations\skin04b Amputations\skin05b + + Amputations\skin01 + Amputations\skin02 + Amputations\skin03 + Amputations\skin04 + Amputations\skin05 \ No newline at end of file diff --git a/media/clothing/clothingItems/Amputation_Left_LowerArm.xml b/media/clothing/clothingItems/Amputation_Left_LowerArm.xml index 727f0e4..e1bce3e 100644 --- a/media/clothing/clothingItems/Amputation_Left_LowerArm.xml +++ b/media/clothing/clothingItems/Amputation_Left_LowerArm.xml @@ -14,4 +14,10 @@ Amputations\skin03b Amputations\skin04b Amputations\skin05b + + Amputations\skin01 + Amputations\skin02 + Amputations\skin03 + Amputations\skin04 + Amputations\skin05 \ No newline at end of file diff --git a/media/clothing/clothingItems/Amputation_Left_UpperArm.xml b/media/clothing/clothingItems/Amputation_Left_UpperArm.xml index c80f229..47033a3 100644 --- a/media/clothing/clothingItems/Amputation_Left_UpperArm.xml +++ b/media/clothing/clothingItems/Amputation_Left_UpperArm.xml @@ -14,4 +14,10 @@ Amputations\skin03b Amputations\skin04b Amputations\skin05b + + Amputations\skin01 + Amputations\skin02 + Amputations\skin03 + Amputations\skin04 + Amputations\skin05 \ No newline at end of file diff --git a/media/clothing/clothingItems/Amputation_Right_Hand.xml b/media/clothing/clothingItems/Amputation_Right_Hand.xml index d20f03a..ae56a63 100644 --- a/media/clothing/clothingItems/Amputation_Right_Hand.xml +++ b/media/clothing/clothingItems/Amputation_Right_Hand.xml @@ -12,4 +12,10 @@ Amputations\skin03b Amputations\skin04b Amputations\skin05b + + Amputations\skin01 + Amputations\skin02 + Amputations\skin03 + Amputations\skin04 + Amputations\skin05 \ No newline at end of file diff --git a/media/clothing/clothingItems/Amputation_Right_LowerArm.xml b/media/clothing/clothingItems/Amputation_Right_LowerArm.xml index 00eddb1..77723ae 100644 --- a/media/clothing/clothingItems/Amputation_Right_LowerArm.xml +++ b/media/clothing/clothingItems/Amputation_Right_LowerArm.xml @@ -14,4 +14,10 @@ Amputations\skin03b Amputations\skin04b Amputations\skin05b + + Amputations\skin01 + Amputations\skin02 + Amputations\skin03 + Amputations\skin04 + Amputations\skin05 \ No newline at end of file diff --git a/media/clothing/clothingItems/Amputation_Right_UpperArm.xml b/media/clothing/clothingItems/Amputation_Right_UpperArm.xml index a4b4bcf..76b9af1 100644 --- a/media/clothing/clothingItems/Amputation_Right_UpperArm.xml +++ b/media/clothing/clothingItems/Amputation_Right_UpperArm.xml @@ -14,4 +14,10 @@ Amputations\skin03b Amputations\skin04b Amputations\skin05b + + Amputations\skin01 + Amputations\skin02 + Amputations\skin03 + Amputations\skin04 + Amputations\skin05 \ No newline at end of file diff --git a/media/lua/client/TOC_Compatibility.lua b/media/lua/client/TOC_Compatibility.lua index 1eff759..5edf504 100644 --- a/media/lua/client/TOC_Compatibility.lua +++ b/media/lua/client/TOC_Compatibility.lua @@ -10,7 +10,7 @@ local function TocReapplyAmputationClothingItem(mod_data) local amputated_clothing_name = "TOC.Amputation_" .. part_name if player_inv:FindAndReturn(amputated_clothing_name) == nil then local amputation_clothing_item = player:getInventory():AddItem(TocFindAmputatedClothingFromPartName(part_name)) - TocSetCorrectTextureForAmputation(amputation_clothing_item, player) + TocSetCorrectTextureForAmputation(amputation_clothing_item, player, mod_data.TOC.Limbs[part_name].is_cicatrized) player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item) end diff --git a/media/lua/client/TOC_Debug.lua b/media/lua/client/TOC_Debug.lua index cc15800..67d729c 100644 --- a/media/lua/client/TOC_Debug.lua +++ b/media/lua/client/TOC_Debug.lua @@ -48,7 +48,7 @@ end -- Set correct body locations for items in inventory function TocResetClothingItemBodyLocation(player, side, limb) local player_inventory = player:getInventory() - + local limbs_data = player:getModData().TOC.Limbs local amputation_item_name = TocFindAmputationInInventory(player, side, limb) local equipped_prosthesis_item_name = TocFindEquippedProsthesisInInventory(player, side, limb) print(amputation_item_name) @@ -61,7 +61,7 @@ function TocResetClothingItemBodyLocation(player, side, limb) player:removeWornItem(amputation_item) player:getInventory():Remove(amputation_item) amputation_item = player_inventory:AddItem(amputation_item_name) - TocSetCorrectTextureForAmputation(amputation_item, player) + TocSetCorrectTextureForAmputation(amputation_item, player, limbs_data[side .. "_" .. limb].is_cicatrized) player:setWornItem(amputation_item:getBodyLocation(), amputation_item) end diff --git a/media/lua/client/TOC_Update.lua b/media/lua/client/TOC_Update.lua index 9004175..fbc9b73 100644 --- a/media/lua/client/TOC_Update.lua +++ b/media/lua/client/TOC_Update.lua @@ -121,9 +121,14 @@ local function SetHealthStatusForBodyPart(part_data, part_name, player) if not part_data[part_name].is_cicatrized then if part_data[part_name].cicatrization_time < 0 then part_data[part_name].is_cicatrized = true + local player_inventory = player:getInventory() + local amputated_clothing_item_name = TocFindAmputationOrProsthesisName(part_name, player, "Amputation") + local amputated_clothing_item = player_inventory:FindAndReturn(amputated_clothing_item_name) - -- TODO make this random if the player gets it or not - + player:removeWornItem(amputated_clothing_item) + TocSetCorrectTextureForAmputation(amputated_clothing_item, player, true) + player:setWornItem(amputated_clothing_item:getBodyLocation(), amputated_clothing_item) + if (not player:HasTrait("Brave")) and ZombRand(1, 11) > 5 then player:getTraits():add("Brave") @@ -203,6 +208,9 @@ local function TocUpdateEveryTenMinutes() for _, part_name in pairs(GetBodyParts()) do if part_data[part_name].is_cut and not part_data[part_name].is_cicatrized then part_data[part_name].cicatrization_time = part_data[part_name].cicatrization_time - SandboxVars.TOC.CicatrizationSpeedMultiplier + + + end end diff --git a/media/lua/client/TOC_Visuals.lua b/media/lua/client/TOC_Visuals.lua index bd7c642..cf8f23f 100644 --- a/media/lua/client/TOC_Visuals.lua +++ b/media/lua/client/TOC_Visuals.lua @@ -1,4 +1,4 @@ -function TocSetCorrectTextureForAmputation(item, player) +function TocSetCorrectTextureForAmputation(item, player, cicatrized) local human_visual = player:getHumanVisual() local texture_string = human_visual:getSkinTexture() @@ -9,8 +9,13 @@ function TocSetCorrectTextureForAmputation(item, player) local matched_index = string.match(texture_string, "%d$") + + if cicatrized then + matched_index = matched_index + 5 -- to use the cicatrized texture + end + print("TOC: Setting texture " .. matched_index) - item:getVisual():setTextureChoice(tonumber(matched_index - 1)) -- TODO why is it correct with -1? + item:getVisual():setTextureChoice(tonumber(matched_index - 1)) -- it counts from 0, so we have to subtract 1 end function TocSetBloodOnAmputation(player, body_part) diff --git a/media/lua/client/TOC_main.lua b/media/lua/client/TOC_main.lua index 380c02f..063ab39 100644 --- a/media/lua/client/TOC_main.lua +++ b/media/lua/client/TOC_main.lua @@ -132,7 +132,7 @@ function TocSetInitData(mod_data, player) if player:HasTrait("Amputee_Hand") then local amputation_clothing_item = player:getInventory():AddItem("TOC.Amputation_Left_Hand") - TocSetCorrectTextureForAmputation(amputation_clothing_item, player) + TocSetCorrectTextureForAmputation(amputation_clothing_item, player, true) player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item) mod_data.TOC.Limbs.Left_Hand.is_cut = true @@ -141,7 +141,7 @@ function TocSetInitData(mod_data, player) mod_data.TOC.Limbs.Left_Hand.is_cicatrized = true elseif player:HasTrait("Amputee_LowerArm") then local amputation_clothing_item = player:getInventory():AddItem("TOC.Amputation_Left_LowerArm") - TocSetCorrectTextureForAmputation(amputation_clothing_item, player) + TocSetCorrectTextureForAmputation(amputation_clothing_item, player, true) player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item) mod_data.TOC.Limbs.Left_LowerArm.is_cut = true @@ -157,7 +157,7 @@ function TocSetInitData(mod_data, player) end elseif player:HasTrait("Amputee_UpperArm") then local amputation_clothing_item = player:getInventory():AddItem("TOC.Amputation_Left_UpperArm") - TocSetCorrectTextureForAmputation(amputation_clothing_item, player) + TocSetCorrectTextureForAmputation(amputation_clothing_item, player, true) player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item) mod_data.TOC.Limbs.Left_UpperArm.is_cut = true