diff --git a/media/lua/client/TOC_Compatibility.lua b/media/lua/client/API/TOC_Compatibility.lua similarity index 100% rename from media/lua/client/TOC_Compatibility.lua rename to media/lua/client/API/TOC_Compatibility.lua diff --git a/media/lua/client/ActionsMethods/TOC_CutLimb.lua b/media/lua/client/ActionsMethods/TOC_CutLimb.lua index 0b2f025..748a0de 100644 --- a/media/lua/client/ActionsMethods/TOC_CutLimb.lua +++ b/media/lua/client/ActionsMethods/TOC_CutLimb.lua @@ -60,7 +60,7 @@ end local function DeleteOtherAmputatedLimbs(side) -- if left hand is cut and we cut left lowerarm, then delete hand for _, limb in pairs(TOC.limbNames) do - local partName = "TOC.Amputation_" .. side .. "_" .. limb + local partName = "TOC.Amputation_" .. TOC_Common.ConcatPartName(side, limb) local amputatedLimbItem = getPlayer():getInventory():FindAndReturn(partName) if amputatedLimbItem then getPlayer():getInventory():Remove(amputatedLimbItem) @@ -175,7 +175,7 @@ TOC.CutLimb = function(partName, surgeonFactor, bandageTable, painkillerTable) if tourniquetItem ~= nil then baseDamageValue = 50 -- TODO Decrease mostly blood and damage, add pain, not everything else - if partName == side .. "_UpperArm" then + if partName == TOC_Common.ConcatPartName(side, "UpperArm") then player:removeWornItem(tourniquetItem) end end diff --git a/media/lua/client/TOC_CommonFunctions.lua b/media/lua/client/TOC_CommonFunctions.lua index deda276..7b1853e 100644 --- a/media/lua/client/TOC_CommonFunctions.lua +++ b/media/lua/client/TOC_CommonFunctions.lua @@ -15,7 +15,7 @@ TOC_Common.GeneratePartNames = function() local partNamesTable = {} for _, side in ipairs(TOC.sideNames) do for _, limb in ipairs(TOC.limbNames) do - local tempPartName = side .. "_" .. limb + local tempPartName = TOC_Common.ConcatPartName(side, limb) table.insert(partNamesTable, tempPartName) end end @@ -42,6 +42,11 @@ TOC_Common.GetSideFromPartName = function(partName) end +TOC_Common.ConcatPartName = function(side, limb) + + return side .. "_" .. limb + +end --------------------------------- TOC_Common.GetAcceptableBodyPartTypes = function() @@ -157,9 +162,6 @@ end ----------------------------------- -- Online Handling checks - ------------------------------------------ --- MP HANDLING CHECKS TOC_Common.CheckIfCanBeCut = function(partName, limbsData) if limbsData == nil then @@ -246,7 +248,7 @@ TOC_Common.CheckIfProsthesisAlreadyInstalled = function(limbsData, partName) for _, side in pairs(TOC.sideNames) do if string.find(partName, side) then - return (limbsData[side .. "_Hand"].isProsthesisEquipped or limbsData[side .. "_LowerArm"].isProsthesisEquipped) + return (limbsData[TOC_Common.ConcatPartName(side, "Hand")].isProsthesisEquipped or limbsData[TOC_Common.ConcatPartName(side, "LowerArm")].isProsthesisEquipped) end end @@ -259,12 +261,12 @@ TOC_Common.GetCanBeHeldTable = function(limbs_data) for _, side in pairs(TOC.sideNames) do canBeHeld[side] = true - if limbs_data[side .. "_Hand"].isCut then - if limbs_data[side .. "_LowerArm"].isCut then - if not limbs_data[side .. "_LowerArm"].isProsthesisEquipped then + if limbs_data[TOC_Common.ConcatPartName(side, "Hand")].isCut then + if limbs_data[TOC_Common.ConcatPartName(side, "LowerArm")].isCut then + if not limbs_data[TOC_Common.ConcatPartName(side, "LowerArm")].isProsthesisEquipped then canBeHeld[side] = false end - elseif not limbs_data[side .. "_Hand"].isProsthesisEquipped then + elseif not limbs_data[TOC_Common.ConcatPartName(side, "Hand")].isProsthesisEquipped then canBeHeld[side] = false end end diff --git a/media/lua/client/TOC_Init.lua b/media/lua/client/TOC_Init.lua index 4eaf17e..90aeb2d 100644 --- a/media/lua/client/TOC_Init.lua +++ b/media/lua/client/TOC_Init.lua @@ -93,7 +93,7 @@ TOC.SetInitData = function(modData, player) } for _, side in pairs(TOC.sideNames) do for _, limb in pairs(TOC.limbNames) do - local partName = side .. "_" .. limb + local partName = TOC_Common.ConcatPartName(side, limb) TOC.InitPart(modData.TOC.limbs, partName) end end @@ -145,7 +145,7 @@ local function InitializeTheOnlyCure() TOC.limbParameters = {} for _, side in pairs(TOC.sideNames) do for _, limb in pairs(TOC.limbNames) do - local partName = side .. "_" .. limb + local partName = TOC_Common.ConcatPartName(side, limb) TOC.limbParameters[partName] = {} if limb == "Hand" then @@ -153,10 +153,10 @@ local function InitializeTheOnlyCure() TOC.limbParameters[partName].dependsOn = {} elseif limb == "LowerArm" then TOC.limbParameters[partName].cicatrizationBaseTime = 1800 - TOC.limbParameters[partName].dependsOn = { side .. "_Hand", } + TOC.limbParameters[partName].dependsOn = { TOC_Common.ConcatPartName(side, "Hand") } elseif limb == "UpperArm" then TOC.limbParameters[partName].cicatrizationBaseTime = 2000 - TOC.limbParameters[partName].dependsOn = { side .. "_Hand", side .. "_LowerArm", } + TOC.limbParameters[partName].dependsOn = { TOC_Common.ConcatPartName(side, "Hand"), TOC_Common.ConcatPartName(side, "LowerArm"), } elseif limb == "Foot" then TOC.limbParameters[partName].cicatrizationBaseTime = 1700 TOC.limbParameters[partName].dependsOn = {} diff --git a/media/lua/client/TOC_ModCompatibility.lua b/media/lua/client/TOC_ModCompatibility.lua index 3a602af..af669f6 100644 --- a/media/lua/client/TOC_ModCompatibility.lua +++ b/media/lua/client/TOC_ModCompatibility.lua @@ -69,4 +69,7 @@ end --- @return integer TOC_Compat.getHands = function(player) return ((TOC_Compat.hasArm(player, parts[1], parts[3]) and 1) or 0) + ((TOC_Compat.hasArm(player, parts[2], parts[4]) and 10) or 0) -end \ No newline at end of file +end + + +return TOC_Compat \ No newline at end of file diff --git a/media/lua/client/TOC_OverridenFunctions.lua b/media/lua/client/TOC_OverridenFunctions.lua index d6c5689..7a499a6 100644 --- a/media/lua/client/TOC_OverridenFunctions.lua +++ b/media/lua/client/TOC_OverridenFunctions.lua @@ -235,7 +235,7 @@ function ISClothingExtraAction:isValid() for _, side in pairs (TOC.sideNames) do if location == side .. "Wrist" then - if limbsData[side .. "_LowerArm"].isCut then + if limbsData[TOC_Common.ConcatPartName(side, "LowerArm")].isCut then return false end end diff --git a/media/lua/client/TOC_Test.lua b/media/lua/client/TOC_Test.lua index 27a5f79..b490a8b 100644 --- a/media/lua/client/TOC_Test.lua +++ b/media/lua/client/TOC_Test.lua @@ -8,7 +8,7 @@ -- Side functions local function TocGetAmputationFullTypeFromInventory(player, side, limb) local player_inventory = player:getInventory() - local item_name = "TOC.Amputation_" .. side .. "_" .. limb + local item_name = "TOC.Amputation_" .. TOC_Common.ConcatPartName(side, limb) local found_item = player_inventory:FindAndReturn(item_name) if found_item then return found_item:getFullType() @@ -18,12 +18,12 @@ local function TocGetAmputationFullTypeFromInventory(player, side, limb) end local function TocGetEquippedProsthesisFullTypeFromInventory(player, side, limb) - local player_inventory = player:getInventory() + local playerInventory = player:getInventory() for _, prost in ipairs(GetProsthesisList()) do - local item_name = TocFindCorrectClothingProsthesis(prost, side .."_" .. limb) - local found_item = player_inventory:FindAndReturn(item_name) - if found_item then - return found_item:getFullType() + local itemName = TocFindCorrectClothingProsthesis(prost, TOC_Common.ConcatPartName(side, limb)) + local foundItem = playerInventory:FindAndReturn(itemName) + if foundItem then + return foundItem:getFullType() end end end @@ -44,7 +44,7 @@ function TocResetClothingItemBodyLocation(player, side, limb) player:removeWornItem(amputationItem) player:getInventory():Remove(amputationItem) amputationItem = playerInv:AddItem(amputationItemName) - TOC_Visuals.SetTextureForAmputation(amputationItem, player, limbsData[side .. "_" .. limb].is_cicatrized) + TOC_Visuals.SetTextureForAmputation(amputationItem, player, limbsData[TOC_Common.ConcatPartName(side, limb)].isCicatrized) player:setWornItem(amputationItem:getBodyLocation(), amputationItem) end amputationItem = nil -- reset it diff --git a/media/lua/client/TOC_Update.lua b/media/lua/client/TOC_Update.lua index ffff5b2..2b85fc4 100644 --- a/media/lua/client/TOC_Update.lua +++ b/media/lua/client/TOC_Update.lua @@ -191,8 +191,8 @@ TOC.UpdateEveryTenMinutes = function() --Experience for prosthesis user for _, side in pairs(TOC.sideNames) do - if partData[side .. "_Hand"].isProsthesisEquipped or partData[side .. "_LowerArm"].isProsthesisEquipped then - player:getXp():AddXP(Perks[side .. "_Hand"], 4) + if partData[TOC_Common.ConcatPartName(side, "Hand")].isProsthesisEquipped or partData[TOC_Common.ConcatPartName(side, "LowerArm")].isProsthesisEquipped then + player:getXp():AddXP(Perks[TOC_Common.ConcatPartName(side, "Hand")], 4) end end